Skip to content

Commit 69fba55

Browse files
authored
Merge pull request avivais#85 from mihado/master
log Android installation flow for easier debugging
2 parents fba6ef8 + 7e489a7 commit 69fba55

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

src/android/ParsePushApplication.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import com.parse.Parse;
66
import com.parse.Parse.Configuration.Builder;
77
import com.parse.ParseInstallation;
8+
import com.parse.SaveCallback;
9+
import com.parse.ParseException;
810

911
import github.taivo.parsepushplugin.ParsePushConfigReader;
1012
import github.taivo.parsepushplugin.ParsePushConfigException;
@@ -61,20 +63,33 @@ public void onCreate(){
6163
//
6264
//initialize for use with legacy parse.com
6365
Parse.initialize(this, config.getAppId(), config.getClientKey());
64-
} else{
66+
} else {
67+
Log.d(LOGTAG, "ServerUrl " + config.getServerUrl());
68+
Log.d(LOGTAG, "NOTE: The trailing slash is important, e.g., https://mydomain.com:1337/parse/");
69+
Log.d(LOGTAG, "NOTE: Set the clientKey if your server requires it, otherwise it can be null");
6570
//
6671
// initialize for use with opensource parse-server
6772
Parse.initialize(new Parse.Configuration.Builder(this)
6873
.applicationId(config.getAppId())
69-
.server(config.getServerUrl()) // The trailing slash is important, e.g., https://mydomain.com:1337/parse/
70-
.clientKey(config.getClientKey()) // Can be null
74+
.server(config.getServerUrl())
75+
.clientKey(config.getClientKey())
7176
.build()
7277
);
7378
}
7479

80+
Log.d(LOGTAG, "Saving Installation in background");
7581
//
7682
// save installation. Parse.Push will need this to push to the correct device
77-
ParseInstallation.getCurrentInstallation().saveInBackground();
83+
ParseInstallation.getCurrentInstallation().saveInBackground(new SaveCallback() {
84+
@Override
85+
public void done(ParseException ex) {
86+
if (null != ex) {
87+
Log.e(LOGTAG, ex.toString());
88+
} else {
89+
Log.d(LOGTAG, "Installation saved");
90+
}
91+
}
92+
});
7893

7994
} catch(ParsePushConfigException ex){
8095
Log.e(LOGTAG, ex.toString());

0 commit comments

Comments
 (0)