Situation
I've implemented push notification with Parse in ANDROID. Everything works great (I can receive push/send etc.), the only thing is that when I install my application it happens this:
- if it is the first install ever on the device: no problem
- if it is not the first install (this means that the device has already made a PARSE/GCM registration) it generates this error:
Error generated
02-12 11:12:28.054 15564-15579/com.hoxell.hoxellbrowser E/ParseCommandCache﹕ Failed to run command.
com.parse.ParseException: at least one ID field (installationId,deviceToken) must be specified in this operation
at com.parse.ParseCommand.onPostExecute(ParseCommand.java:404)
at com.parse.ParseRequest$5.then(ParseRequest.java:342)
at com.parse.ParseRequest$5.then(ParseRequest.java:339)
at bolts.Task$10.run(Task.java:486)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:97)
at bolts.Task.completeAfterTask(Task.java:482)
at bolts.Task.continueWithTask(Task.java:358)
at bolts.Task.continueWithTask(Task.java:369)
at bolts.Task$8.then(Task.java:415)
at bolts.Task$8.then(Task.java:407)
at bolts.Task$10.run(Task.java:486)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:97)
at bolts.Task.completeAfterTask(Task.java:482)
at bolts.Task.access$200(Task.java:27)
at bolts.Task$6.then(Task.java:351)
at bolts.Task$6.then(Task.java:348)
at bolts.Task.runContinuations(Task.java:515)
at bolts.Task.access$600(Task.java:27)
at bolts.Task$TaskCompletionSource.trySetResult(Task.java:570)
at bolts.Task$TaskCompletionSource.setResult(Task.java:604)
at bolts.Task$10$1.then(Task.java:498)
at bolts.Task$10$1.then(Task.java:490)
at bolts.Task$9.run(Task.java:453)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:97)
at bolts.Task.completeImmediately(Task.java:449)
at bolts.Task.access$100(Task.java:27)
at bolts.Task$5.then(Task.java:316)
at bolts.Task$5.then(Task.java:313)
at bolts.Task.runContinuations(Task.java:515)
at bolts.Task.access$600(Task.java:27)
at bolts.Task$TaskCompletionSource.trySetResult(Task.java:570)
at bolts.Task$TaskCompletionSource.setResult(Task.java:604)
at bolts.Task$10$1.then(Task.java:498)
at bolts.Task$10$1.then(Task.java:490)
at bolts.Task$9.run(Task.java:453)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:97)
at bolts.Task.completeImmediately(Task.java:449)
at bolts.Task.access$100(Task.java:27)
at bolts.Task$5.then(Task.java:316)
at bolts.Task$5.then(Task.java:313)
at bolts.Task.runContinuations(Task.java:515)
at bolts.Task.access$600(Task.java:27)
at bolts.Task$TaskCompletionSource.trySetResult(Task.java:570)
at bolts.Task$TaskCompletionSource.setResult(Task.java:604)
at bolts.Task$10$1.then(Task.java:498)
at bolts.Task$10$1.then(Task.java:490)
at bolts.Task$9.run(Task.java:453)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:97)
at bolts.Task.completeImmediately(Task.java:449)
at bolts.Task.continueWith(Task.java:323)
at bolts.Task.continueWith(Task.java:334)
at bolts.Task$10.run(Task.java:490)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:97)
at bolts.Task.completeAfterTask(Task.java:482)
at bolts.Task.access$200(Task.java:27)
at bolts.Task$6.then(Task.java:351)
at bolts.Task$6.then(Task.java:348)
at bolts.Task.runContinuations(Task.java:515)
at bolts.Task.access$600(Task.java:27)
at bolts.Task$TaskCompletionSource.trySetResult(Task.java:570)
at bolts.Task$TaskCompletionSource.setResult(Task.java:604)
at bolts.Task$10$1.then(Task.java:498)
at bolts.Task$10$1.then(Task.java:490)
at bolts.Task$9.run(Task.java:453)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:97)
at bolts.Task.completeImmediately(Task.java:449)
at bolts.Task.continueWith(Task.java:323)
at bolts.Task.continueWith(Task.java:334)
at bolts.Task$10.run(Task.java:490)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:864)
Yeah, it generates it but the app do not crash! and the app still works: push notifications too, but you can understand that this is not 100% reliable.
E/ParseCommandCache﹕ Failed to run command.
com.parse.ParseException: at least one ID field (installationId,deviceToken) must be specified in this operation
What does he want..? What should I do? What is the cause of the problem? Here is my code:
Application.java
@Override
public void onCreate() {
super.onCreate();
// Initialize the Parse SDK.
Parse.initialize(this, "x", "x");
// Specify an Activity to handle all pushes by default.
PushService.setDefaultPushCallback(this, MainActivity.class);
ParseInstallation.getCurrentInstallation().saveInBackground();
}
In my mainActivity I just concatenate the deviceToken (in my case it is the installationId) into my userAgent: and this work fine too! Even if the error is generated, the installationID is inserted into the userAgent.
MainActivity.java
deviceToken = ParseInstallation.getCurrentInstallation().getInstallationId();
webSettings.setUserAgentString(userAgent + " ||" + deviceToken);
Am I making any mistakes into my code?
Thank you