Error with FCM + SNS Token on Android app - android

I've followed AWS Mobile Hub push integration guide, and integrated AWS SNS push services in my app. When I open the app I get this error log:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.intap.appme, PID: 23576
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.intap.name/com.intap.name.MainActivity}: com.amazonaws.AmazonServiceException: 1 validation error detected: Value null at 'token' failed to satisfy constraint: Member must not be null (Service: AmazonSNS; Status Code: 400; Error Code: ValidationError; Request ID: 21d6a3b2-0459-513a-bf7a-f3c1d99d41ac)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3253)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
at android.app.ActivityThread.access$1100(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: com.amazonaws.AmazonServiceException: 1 validation error detected: Value null at 'token' failed to satisfy constraint: Member must not be null (Service: AmazonSNS; Status Code: 400; Error Code: ValidationError; Request ID: 21d6a3b2-0459-513a-bf7a-f3c1d99d41ac)
at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:712)
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:388)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:199)
at com.amazonaws.services.sns.AmazonSNSClient.invoke(AmazonSNSClient.java:2262)
at com.amazonaws.services.sns.AmazonSNSClient.createPlatformEndpoint(AmazonSNSClient.java:447)
at com.amazonaws.mobile.push.PushManager.subscribeToTopic(PushManager.java:264)
at com.intap.name.MainActivity.onCreate(MainActivity.java:50)
at android.app.Activity.performCreate(Activity.java:6876)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:158) 
at android.app.ActivityThread.main(ActivityThread.java:7224) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
The code lines mentioned in the app are those lines:
PushManager.java:264 (The whole method)
public void subscribeToTopic(final SnsTopic topic) {
final CreatePlatformEndpointRequest endpointRequest = new CreatePlatformEndpointRequest();
endpointRequest.setPlatformApplicationArn(platformApplicationArn);
try {
endpointRequest.setToken(InstanceID.getInstance(context).getToken(sharedPreferences.getString("deviceToken", ""), GoogleCloudMessaging.INSTANCE_ID_SCOPE));
} catch (IOException e) {
Log.e("Error", e.getMessage());
}
/* This is line 264 -> */ final CreatePlatformEndpointResult endpointResult = sns.createPlatformEndpoint(endpointRequest);
final SubscribeRequest request = new SubscribeRequest();
request.setEndpoint(endpointResult.getEndpointArn());
request.setTopicArn(topic.getTopicArn());
request.setProtocol(SNS_PROTOCOL_APPLICATION);
final SubscribeResult result = sns.subscribe(request);
// update topic and save subscription in shared preferences
final String subscriptionArn = result.getSubscriptionArn();
topic.setSubscriptionArn(subscriptionArn);
sharedPreferences.edit().putString(topic.getTopicArn(), subscriptionArn).apply();
}
MainActivity.java:50
pushManager.subscribeToTopic(pushManager.getDefaultTopic());
When I'm trying to send a push message through the online Firebase console, The device gets the push messages, and when I click on the message to open the app it keeps crashing.
When I'm trying to send a push message through the online SNS console, I don't get any push notfiications, which means the error is in the registration to SNS.
How can I solve it? I have no idea about it...

The token is coming back as null from Google's SDK. The reason is due to this line:
endpointRequest.setToken(InstanceID.getInstance(context)
.getToken(sharedPreferences.getString("deviceToken", ""),
GoogleCloudMessaging.INSTANCE_ID_SCOPE));
The first parameter to getToken() should be the GCM Sender ID rather than the device token that is being passed as pulled from sharedPreferences. Changing your code to pass the sender ID as follows, should fix the issue:
endpointRequest.setToken(InstanceID.getInstance(context)
.getToken(gcmSenderID, GoogleCloudMessaging.INSTANCE_ID_SCOPE));
Also, it appears that the code you pasted was modified from a Mobile Hub project that was generated in the fairly distant past. There have been improvements in the PushManager since then. The latest versions generated by the Mobile Hub would use the GCMTokenHelper class, which is not present in the code you pasted. Please try generating the sample app or SDK using the Mobile Hub again and updating your app to use the more recently generated code and report back if you are still experiencing issues.

Related

No ChallengeStatusReceiver for transaction id

My React Native app is crashing when some users try to add a payment method in production. This is happening on Android only. I cannot reproduce it in debug. I'm getting this mysterious error report in Sentry and after some Googling I have no idea what this error means:
No ChallengeStatusReceiver for transaction id
d.q.a.g1.i.d: No ChallengeStatusReceiver for transaction id
at d.q.a.g1.l.s.a
at d.q.a.g1.l.q.c
at d.q.a.g1.l.q.b
at d.q.a.g1.l.y$a.onPostExecute
at android.os.AsyncTask.finish(AsyncTask.java:755)
at android.os.AsyncTask.access$900(AsyncTask.java:192)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:772)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8167)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
I'm using tipsi-stripe and I'm pretty sure this error is happening when calling stripe.confirmSetupIntent(). This method presents an authentication "challenge" if the user's bank requires it.
The flow I'm using now is:
user enter payment details:
const createPaymentMethodParams = {
"billingDetails":{
"name":"First Last"
},
"card":{
"cvc":"333",
"expMonth":12,
"expYear":23,
"number":"4111111111111111"
}
}
Call the backend, which creates a setup intent with confirmation_method=manual. This returns a client_secret
"Create" the payment method with createPaymentMethod, which returns payment method id.
const paymentMethodData = await
stripe.createPaymentMethod(createPaymentMethodParams)
Finally, confirm the setup intent (this is the step which sometimes crashes):
// confirm the setup intent:
// - if authentication is required user will be redirected to auth flow
// - if no authentication is required this directly returns paymentMethodId
const { status, paymentMethodId } = await stripe.confirmSetupIntent({
clientSecret: intent.client_secret, // previously obtained from backend
paymentMethodId: paymentMethodData.id,
})
The most relevant result I found on Google was this https://adyen.github.io/adyen-3ds2-android/com/adyen/threeds2/ChallengeStatusReceiver.html
It refers to a 3DS sdk (as in "3-D Secure"), which would make sense to see at this stage when the user is required to authenticate. However I'm really not sure I'm on the right track...
Has anyone encountered this issue and can help me understand it, or point me in a direction? Any help greatly appreciated!

AWS Cognito user: Device confirmation failed

I am using CognitoAuth library from Amazon to manage user authentication.
In the AWS console, the "Do you want to remember your user's devices?" option is set to 'Always'.
But when I call getSession method on a CognitoUse object, in onSuccess callback, I always do get 'newDevice' param as null. It is supposed to be not null because the option to remember device is enabled. Because of that I cannot refresh the token and getting the exception below:
Device confirmation failed:
com.amazonaws.mobileconnectors.cognitoidentityprovider.exceptions.CognitoNotAuthorizedException: User is not authenticated
at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser.getCachedSession(CognitoUser.java:981)
at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser.confirmDevice(CognitoUser.java:3287)
at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser.handleChallenge(CognitoUser.java:2607)
at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser.respondToChallenge(CognitoUser.java:2409)
at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser$24.run(CognitoUser.java:2480)
at com.amazonaws.mobileconnectors.cognitoidentityprovider.continuations.AuthenticationContinuation.continueTask(AuthenticationContinuation.java:124)
at com.amazonaws.mobile.client.AWSMobileClient$6$1.getAuthenticationDetails(AWSMobileClient.java:1177)
at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser.getSession(CognitoUser.java:778)
at com.amazonaws.mobile.client.AWSMobileClient$6.run(AWSMobileClient.java:1137)
at com.amazonaws.mobile.client.internal.InternalCallback$1.run(InternalCallback.java:101)
at java.lang.Thread.run(Thread.java:764)
Caused by: com.amazonaws.services.cognitoidentityprovider.model.NotAuthorizedException: Invalid Refresh Token. (Service: AmazonCognitoIdentityProvider; Status Code: 400; Error Code: NotAuthorizedException; Request ID: ed2f2501-7a36-447f-ac29-c4ab4741958e)
at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:730)
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:405)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:212)
at com.amazonaws.services.cognitoidentityprovider.AmazonCognitoIdentityProviderClient.invoke(AmazonCognitoIdentityProviderClient.java:6292)
at com.amazonaws.services.cognitoidentityprovider.AmazonCognitoIdentityProviderClient.initiateAuth(AmazonCognitoIdentityProviderClient.java:4277)
at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser.refreshSession(CognitoUser.java:2378)
at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser.getCachedSession(CognitoUser.java:976)
at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser.confirmDevice(CognitoUser.java:3287) 
at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser.handleChallenge(CognitoUser.java:2607) 
at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser.respondToChallenge(CognitoUser.java:2409) 
at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser$24.run(CognitoUser.java:2480) 
at com.amazonaws.mobileconnectors.cognitoidentityprovider.continuations.AuthenticationContinuation.continueTask(AuthenticationContinuation.java:124) 
at com.amazonaws.mobile.client.AWSMobileClient$6$1.getAuthenticationDetails(AWSMobileClient.java:1177) 
at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser.getSession(CognitoUser.java:778) 
at com.amazonaws.mobile.client.AWSMobileClient$6.run(AWSMobileClient.java:1137) 
at com.amazonaws.mobile.client.internal.InternalCallback$1.run(InternalCallback.java:101) 
at java.lang.Thread.run(Thread.java:764) 
Why is no CognitoDevice object received? How to resolve this?

Exception when authenticating with wrong verification code

I'm using Firebase Phone Authentification to verify users accounts. When I try to authenticate with a wrong verification code, I get an IllegalArgumentException. Is there any way to fix that without using try catch blocks?
Here is the exception message :
java.lang.IllegalArgumentException: Cannot create PhoneAuthCredential without either verificationProof, sessionInfo, or temporaryProof.
at com.google.android.gms.common.internal.zzbq.checkArgument(Unknown Source)
at com.google.firebase.auth.PhoneAuthCredential.<init>(Unknown Source)
at com.google.firebase.auth.PhoneAuthProvider.getCredential(Unknown Source)
at com.example.myApp.testFragment$3$4.onClick(testFragment.java:316)
at android.view.View.performClick(View.java:5197)
at android.view.View$PerformClick.run(View.java:20926)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
And here is the line where I get the error :
PhoneAuthCredential credential = PhoneAuthProvider.getCredential(verificationCode, inputCode);
I'm intentionally using wrong verification code in inputCode and hoping to get an error message instead of the exception.
It returns an exception so the aim should be to catch the exception it throws in the debug console. I do that by wrapping the portion of that code in a try catch and Toast it out for the user of the aim to see rather than the usual crash which isnt visible to the End Users.
Like this...
private void verifyCode(String code) {
try {
PhoneAuthCredential credential = PhoneAuthProvider.getCredential(verificationId, code);
signInWithCredential(credential);
}catch (Exception e){
Toast toast = Toast.makeText(this, "Verification Code is wrong", Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER,0,0);
toast.show();
}
}
Calls to PhoneAuthProvider.getCredential(...) return a PhoneAuthCredential object, which is defined as:
Wraps phone number and verification information for authentication purposes.
So getCredential() cannot return an error message. Instead it throws an exception if there is a problem with the verification/credential information you provided.
I was getting same issue and resolved it. actually you need to check verificationId and code is not null
Thanks.
I got the same error, just add the SHA certificates. Error will dissolved.

Android RemoteServiceException: Bad notification posted from package Couldn't cache contentViews

I have an Android app that is crashing due to an unhandled exeption, but only on one particular device (running Nougat). I believe they are the only one of my testers that is running Nougat. This is the exception:
Java.Lang.RuntimeException: Bad notification posted from package [my
package name]: Couldn't cache contentViews: package=[my package name]
Here is the stack trace:
android.app.RemoteServiceException: Bad notification posted from package com.elephanigma.starmygrooves: Couldn't cache contentViews: package=com.elephanigma.starmygrooves
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1675)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6247)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
Xamarin caused by: Java.Lang.RuntimeException: Bad notification posted from package com.elephanigma.starmygrooves: Couldn't cache contentViews: package=com.elephanigma.starmygrooves
--- End of managed Java.Lang.RuntimeException stack trace ---
android.app.RemoteServiceException: Bad notification posted from package com.elephanigma.starmygrooves: Couldn't cache contentViews: package=com.elephanigma.starmygrooves
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1675)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6247)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
The stack trace does not show any of my own code. My app does not create any notifications itself, but it does use an open source package (Xamarin Media Manager) that does. The stack trace does not show any of that package's code either.
So, I'm not sure where to look. I have tried searching for this exception, and although I get a couple of hits for "Bad notification posted", none of them seem to address my issue. I do not get ANY hits for "Couldn't cache contentViews".
If it helps, here is the code (as best I can tell) from the package that creates the notification: (note this is c# code, because it's using Xamarin/Mono)
/// <summary>
/// When we start on the foreground we will present a notification to the user
/// When they press the notification it will take them to the main page so they can control the music
/// </summary>
public void StartNotification(IMediaFile mediaFile, bool mediaIsPlaying, bool canBeRemoved)
{
var icon = (_appliactionContext.Resources?.GetIdentifier("xam_mediamanager_notify_ic", "drawable", _appliactionContext?.PackageName)).GetValueOrDefault(0);
_notificationStyle.SetMediaSession(_sessionToken);
_notificationStyle.SetCancelButtonIntent(_pendingCancelIntent);
_builder = new NotificationCompat.Builder(_appliactionContext)
{
MStyle = _notificationStyle
};
_builder.SetSmallIcon(icon != 0 ? icon : _appliactionContext.ApplicationInfo.Icon);
_builder.SetContentIntent(_pendingIntent);
_builder.SetOngoing(mediaIsPlaying);
_builder.SetVisibility(1);
SetMetadata(mediaFile);
AddActionButtons(mediaIsPlaying);
if (_builder.MActions.Count >= 3)
((NotificationCompat.MediaStyle)(_builder.MStyle)).SetShowActionsInCompactView(0, 1, 2);
NotificationManagerCompat.From(_appliactionContext)
.Notify(MediaServiceBase.NotificationId, _builder.Build());
}

Push notification Error with Parse

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
Try the following below:
ParseInstallation.getCurrentInstallation().saveInBackground(new SaveCallback()
{
#Override
public void done(ParseException e)
{
PushService.setDefaultPushCallback(Application.this, MainActivit.class);
}
});
As I recall, you do not need to save the installation when using setDefaultPushCallback. Try removing the saving of installation and see if it still happens.
setDefaultPushCallback will automatically save the installation for you. Cannot remember where I found it, but at some forum it was told to be the behavior. I guess a second save right after (without the first yet completed) brings the installation in a bad state, causing the non-fatal error msg.

Categories

Resources