When integrating the ETPush SDK in our Android APP, we first ignored the advised approach to put the call to ETPush.configureSdk() into the application's onCreate() method, but rather attaching things to our Dagger object graph lifecycle.
This approach causes reproducible crashes (see stacktrace) after the application is terminated. After moving initialisation to the suggested place, we noticed that there is a mechanism to restart the app from a service that comes with the SDK, which is proven by the fact that we see a new app process spawning (adb shell ps) without being triggered by the user.
Our questions:
- What is the exact purpose of insisting on configuring the SDK within onCreate()?
- Is there a technical explanation / need for starting the application "magically" by itself?
- What would be the recommended approach to fully disable this mechanism in case of unexpected issues without completely removing the SDK and without a new app release?
It feels a bit creepy to have something like that in our app that practically takes full control.
Thanks a lot.
Stacktrace example:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycompany/com.mycompany.ui.activities.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.exacttarget.etpushsdk.ETPush$a.c()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3254)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350)
at android.app.ActivityThread.access$1100(ActivityThread.java:222)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.exacttarget.etpushsdk.ETPush$a.c()' on a null object reference
at com.exacttarget.etpushsdk.ETPush.configureSdk(ETPush.java:296)
at com.mycompany.business.trackers.SalesForceTracker.<init>(SalesForceTracker.java:133)
... more dagger stuff