Brief . Nothing is added to the parser token when I use the new GCM API . now the next type of device token added to the Parse installation table.
DeviceToken: | ID | 1 |: crGctxOB068: APA91bFgPRehabJcm9CYdS948iqX2_ppLj02CtbzmEHR0cfbuPooq5F - hqqvR9AH- Ez6MWMQON1Toc2DiNJTNdpRc3nmm3ukIpWJ1jHaXq0Iug6MoHbmKb9U0ak2CrKznkpKnPY5_Jp
Detailed Description :
I used the new GCM api to get the registration id. I need regId for internal use.
I used the code from the following google link: Google cloud messaging android .
I noted one point. when ever i start parsing an application, get deviceToken correctly. After logging in, I update the user field using the following code in onCreate mainActivity
ParseACL acl = new ParseACL(); acl.setPublicReadAccess(true); acl.setPublicWriteAccess(true); ParseInstallation installation = ParseInstallation.getCurrentInstallation(); installation.setACL(acl); if (ParseUser.getCurrentUser() != null) { installation.put("user", ParseUser.getCurrentUser()); } installation.saveInBackground(new SaveCallback() { @Override public void done(ParseException e) { if (e == null) { Log.e("installation", "success"); Log.i("parse", "token after save : " + ParseInstallation.getCurrentInstallation().getString("deviceToken")); ParsePush.subscribeInBackground("", new SaveCallback() { @Override public void done(ParseException e) { if (e != null) { Log.e("error: ", e.getLocalizedMessage()); e.printStackTrace(); } else { Log.e("subscribed: ", "to broadcast channel"); Log.i("parse", "token after subscribe : " + ParseInstallation.getCurrentInstallation().getString("deviceToken")); } } }); } else { Log.e("installation", "failed"); e.printStackTrace(); } } });
Usually, when the above code run deviceToken was changed to the aforementioned token, which seems wrong. So my push notification is not working.
source share