Clash between onesignal and location on android

I’ve been using onesignal for a few weeks and came across a problem. For some reason the onesignal init routine stopped working on Android. This happens on several devices.

After trying lots of changes, I finally determined that android permissions for location were causing the init to fail.

I proved this by taking the onesignal example app and inserting location permissions into it. Registering with onesignal failed.

Below is logcat output that points to the failure.

I get successful Google notification, but nothing else.

V/Corona  ( 3755): Loading via reflection: CoronaProvider.licensing.google.LuaLoader

V/Corona  ( 3755): > Class.forName: OneSignal.LuaLoader

D/dalvikvm( 3755): GC_CONCURRENT freed 431K, 47% free 3194K/5959K, external 0K/512K, paused 7ms+10ms

V/Corona  ( 3755): < Class.forName: OneSignal.LuaLoader

V/Corona  ( 3755): Loading via reflection: OneSignal.LuaLoader

I/dalvikvm( 3755): Failed resolving Lcom/onesignal/ActivityLifecycleListener; interface 133 ‘Landroid/app/Application$ActivityLifecycleCallbacks;’

W/dalvikvm( 3755): Link of class ‘Lcom/onesignal/ActivityLifecycleListener;’ failed

E/dalvikvm( 3755): Could not find class ‘com.onesignal.ActivityLifecycleListener’, referenced from method com.onesignal.OneSignal.init

W/dalvikvm( 3755): VFY: unable to resolve new-instance 3448 (Lcom/onesignal/ActivityLifecycleListener;) in Lcom/onesignal/OneSignal;

D/dalvikvm( 3755): VFY: replacing opcode 0x22 at 0x0106

D/dalvikvm( 3755): VFY: dead code 0x0108-010d in Lcom/onesignal/OneSignal;.init (Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Lcom/onesignal/OneSignal$NotificationOpenedHandler;)V

D/NativeCrypto( 1542): returned from sslSelect() with result 1, error code 2

I/Corona  ( 3755): Starting Corona OneSignal SDK v1.11.0

I/keystore( 1265): uid: 1000 action: e -> 7 state: 3 -> 3 retry: 4

I/keystore( 1265): uid: 1000 action: e -> 7 state: 3 -> 3 retry: 4

I/dalvikvm( 3755): Could not find method android.app.Service.onTaskRemoved, referenced from method com.onesignal.SyncService.onTaskRemoved

W/dalvikvm( 3755): VFY: unable to resolve virtual method 652: Landroid/app/Service;.onTaskRemoved (Landroid/content/Intent;)V

D/dalvikvm( 3755): VFY: replacing opcode 0x6f at 0x0000

D/dalvikvm( 3755): VFY: dead code 0x0003-0006 in Lcom/onesignal/SyncService;.onTaskRemoved (Landroid/content/Intent;)V

W/System.err( 3755): java.lang.NullPointerException

W/System.err( 3755):     at java.lang.reflect.Field.getField(Native Method)

W/System.err( 3755):     at java.lang.reflect.Field.get(Field.java:237)

W/System.err( 3755):     at com.onesignal.ActivityLifecycleListenerCompat.startListener(ActivityLifecycleListenerCompat.java:47)

W/System.err( 3755):     at com.onesignal.OneSignal.init(OneSignal.java:295)

W/System.err( 3755):     at OneSignal.LuaLoader$InitFunction.invoke(LuaLoader.java:115)

Hello,

Sorry about this Android issue, this bug first appeared in version 1.11.0 of our SDK. We just released version 1.11.1 today that fixes this registration bug.

Thanks.

Seems we still have problems.

W/OneSignal(15125): Location permission exists but there was an error initializing: 

W/OneSignal(15125): java.lang.NoClassDefFoundError: com.google.android.gms.location.LocationServices

W/OneSignal(15125): at com.onesignal.LocationGMS.startGetLocation(LocationGMS.java:106)

W/OneSignal(15125): at com.onesignal.LocationGMS.getLocation(LocationGMS.java:74)

W/OneSignal(15125): at com.onesignal.OneSignal.startRegistrationOrOnSession(OneSignal.java:350)

W/OneSignal(15125): at com.onesignal.OneSignal.init(OneSignal.java:319)

W/OneSignal(15125): at OneSignal.LuaLoader$InitFunction.invoke(LuaLoader.java:81)

W/OneSignal(15125): at com.ansca.corona.JavaToNativeShim.nativeResize(Native Method)

W/OneSignal(15125): at com.ansca.corona.JavaToNativeShim.resize(JavaToNativeShim.java:378)

W/OneSignal(15125): at com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onSurfaceChanged(CoronaGLSurfaceView.java:378)

W/OneSignal(15125): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1612)

W/OneSignal(15125): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1378)

The latest update catches this error and makes it a warning so the device will still register correctly with OneSignal. We are looking into fixing the warning so it no longer shows up in the logcat.

Let us know if still seeing an issue with the device registering however.

Thanks.

Hello,

Sorry about this Android issue, this bug first appeared in version 1.11.0 of our SDK. We just released version 1.11.1 today that fixes this registration bug.

Thanks.

Seems we still have problems.

W/OneSignal(15125): Location permission exists but there was an error initializing: 

W/OneSignal(15125): java.lang.NoClassDefFoundError: com.google.android.gms.location.LocationServices

W/OneSignal(15125): at com.onesignal.LocationGMS.startGetLocation(LocationGMS.java:106)

W/OneSignal(15125): at com.onesignal.LocationGMS.getLocation(LocationGMS.java:74)

W/OneSignal(15125): at com.onesignal.OneSignal.startRegistrationOrOnSession(OneSignal.java:350)

W/OneSignal(15125): at com.onesignal.OneSignal.init(OneSignal.java:319)

W/OneSignal(15125): at OneSignal.LuaLoader$InitFunction.invoke(LuaLoader.java:81)

W/OneSignal(15125): at com.ansca.corona.JavaToNativeShim.nativeResize(Native Method)

W/OneSignal(15125): at com.ansca.corona.JavaToNativeShim.resize(JavaToNativeShim.java:378)

W/OneSignal(15125): at com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onSurfaceChanged(CoronaGLSurfaceView.java:378)

W/OneSignal(15125): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1612)

W/OneSignal(15125): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1378)

The latest update catches this error and makes it a warning so the device will still register correctly with OneSignal. We are looking into fixing the warning so it no longer shows up in the logcat.

Let us know if still seeing an issue with the device registering however.

Thanks.