-
Notifications
You must be signed in to change notification settings - Fork 451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switched to 0.10.3 and app crashes #151
Comments
Hello @rterek , It sounds like there is an issue with Context provided during Estimote SDK initialisation. You should provide application context. Like here: |
But I need to init/start Estimote from an Android Service, so I have been doing: public class MyService extends Service { How can I deal with this moving forward? I'm building a library that is to be used by multiple apps, and I need a Service for control issues. Thanks! |
Hello @rterek! There is no problem with that - Service itself extends ContextWrapper which extends Context. And as you might know, every Context holds reference to a singleton ApplicationContext which represents your basic app context, and which lasts for as long as your app is running. You can simply init Estimote SDK inside your Service by using |
Thanks, got it - I think I was a bit bleary eyed last night when I was dealing with this issue. Cheers! |
No problem, I forgive you :) Keep calm and wait for 0.10.4 with simplified contexts :) |
Hi All, But I unable to find any such initialize(applicationContext, appId, appToken) method in Xamarin Estimote SDK-1.0.3 in android. Thanks, |
I've had an app working for a couple of months, and recently have been using version 0.10.1. I just upgraded to 0.10.3 and rebuilt, ran on a Note 4 with Android 5.1.1, and I get a crash on init:
05-09 22:23:16.884 9534-9534/com.nothing.nothing E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.nothing.nothing, PID: 9534
java.lang.RuntimeException: Unable to instantiate service com.estimote.sdk.service.BeaconService: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.ContentResolver android.content.Context.getContentResolver()' on a null object reference
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3653)
at android.app.ActivityThread.access$2000(ActivityThread.java:197)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6872)
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:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.ContentResolver android.content.Context.getContentResolver()' on a null object reference
at com.estimote.sdk.cloud.internal.AnalyticsManager.(AnalyticsManager.java:73)
at com.estimote.sdk.cloud.internal.AnalyticsManager.getInstance(AnalyticsManager.java:63)
at com.estimote.sdk.service.BeaconService.(BeaconService.java:248)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.Class.newInstance(Class.java:1690)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3650)
at android.app.ActivityThread.access$2000(ActivityThread.java:197)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6872)
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:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Did I miss a memo? Do I need to change something in my code? I'm not doing anything with the cloud. . .
The text was updated successfully, but these errors were encountered: