how to handle AUTHENTICATION FAILED RuntimeException ??

i’m getting this error in some of my devices (Emulators) google nexus one , google nexus s etc


E/AndroidRuntime: FATAL EXCEPTION: main
 Process: pb.myPackage, PID: 13531
 java.lang.RuntimeException: Unable to start receiver com.backendless.push.BackendlessBroadcastReceiver: java.lang.RuntimeException: AUTHENTICATION_FAILED
 at android.app.ActivityThread.handleReceiver(ActivityThread.java:2426)
 at android.app.ActivityThread.access$1700(ActivityThread.java:135)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1272)
 at android.os.Handler.dispatchMessage(Handler.java:102)
 at android.os.Looper.loop(Looper.java:136)
 at android.app.ActivityThread.main(ActivityThread.java:5017)
 at java.lang.reflect.Method.invokeNative(Native Method)
 at java.lang.reflect.Method.invoke(Method.java:515)
 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
 at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.RuntimeException: AUTHENTICATION_FAILED
 at com.backendless.push.BackendlessBroadcastReceiver.onError(BackendlessBroadcastReceiver.java:148)
 at com.backendless.push.BackendlessBroadcastReceiver.handleRegistration(BackendlessBroadcastReceiver.java:292)
 at com.backendless.push.BackendlessBroadcastReceiver.handleIntent(BackendlessBroadcastReceiver.java:159)
 at com.backendless.push.BackendlessBroadcastReceiver.onReceive(BackendlessBroadcastReceiver.java:128)
 at android.app.ActivityThread.handleReceiver(ActivityThread.java:2419)
 at android.app.ActivityThread.access$1700(ActivityThread.java:135) 
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1272) 
 at android.os.Handler.dispatchMessage(Handler.java:102) 
 at android.os.Looper.loop(Looper.java:136) 
 at android.app.ActivityThread.main(ActivityThread.java:5017) 
 at java.lang.reflect.Method.invokeNative(Native Method) 
 at java.lang.reflect.Method.invoke(Method.java:515) 
 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
 at dalvik.system.NativeStart.main(Native Method) 

i followed some related threads and the conclusion was incorrect credentials in google accounts (not in my case i double checked it)

but the worse thing is that i’m not able to handle this exception , i followed this related thread

where the solution for handling exception is :

 subclass BackendlessBroadcastReceive and add your override for the onError method:public void onError( Context context, String message ){throw new RuntimeException( message );}

so i tried this :


import android.content.Context;
import android.widget.Toast;
import com.backendless.push.BackendlessBroadcastReceiver;
/**
 * Created by MACBOOK on 8/15/16.
 */
public class BroadcastReceiver extends BackendlessBroadcastReceiver {
 public void onError(Context context, String message )
 {
 Toast.makeText(context,""+message,Toast.LENGTH_SHORT).show();
 throw new RuntimeException( message );
 }
}

but still i’m getting the error , am i doing it incorrectly ??

Don’t re-throw it in the onError method

Just show the toaster and exit

i tried your suggestion but i’m still gettin the same error

ok now its working , my fault and thanks a lot