NAXAM / mapbox-xamarin-forms

Mapbox on Xamarin.Forms
Apache License 2.0
73 stars 41 forks source link

Telemetry Service IllegalStateException: Not Allowed To Start Service #90

Open asimwaleed opened 4 years ago

asimwaleed commented 4 years ago

I got this exception in android Xamarin on >=8.0 versions. This exception occurs when app is in background or completely closed.

time: 1595928832592
msg: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=myPackage/com.mapbox.android.telemetry.TelemetryService }: app is in background uid UidRecord{some code SVC  idle change:uncached procs:1 seq(0,0,0)}
stacktrace: java.lang.ExceptionInInitializerError
    at com.mapbox.mapboxsdk.maps.Telemetry$TelemetryHolder.access$000(Telemetry.java:41)
    at com.mapbox.mapboxsdk.maps.Telemetry.obtainTelemetry(Telemetry.java:46)
    at com.mapbox.mapboxsdk.maps.Telemetry.initialize(Telemetry.java:30)
    at com.mapbox.mapboxsdk.Mapbox.getInstance(Mapbox.java:49)
    at crc64d39f5c12545d49b7.MainApplication.n_onCreate(Native Method)
    at crc64d39f5c12545d49b7.MainApplication.onCreate(MainApplication.java:31)
    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5925)
    at android.app.ActivityThread.access$1100(ActivityThread.java:201)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1657)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6723)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:495)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=my package/com.mapbox.android.telemetry.TelemetryService }: app is in background uid UidRecord{efd5009 u0a1369 SVC  idle change:uncached procs:1 seq(0,0,0)}
    at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1577)
    at android.app.ContextImpl.startService(ContextImpl.java:1532)
    at android.content.ContextWrapper.startService(ContextWrapper.java:664)
    at com.mapbox.android.telemetry.MapboxTelemetry.startLocation(MapboxTelemetry.java:491)
    at com.mapbox.android.telemetry.MapboxTelemetry.startTelemetryService(MapboxTelemetry.java:227)
    at com.mapbox.android.telemetry.MapboxTelemetry.optLocationIn(MapboxTelemetry.java:198)
    at com.mapbox.android.telemetry.MapboxTelemetry.startTelemetry(MapboxTelemetry.java:462)
    at com.mapbox.android.telemetry.MapboxTelemetry.enable(MapboxTelemetry.java:137)
    at com.mapbox.mapboxsdk.maps.Telemetry.<init>(Telemetry.java:25)
    at com.mapbox.mapboxsdk.maps.Telemetry.<init>(Telemetry.java:10)
    at com.mapbox.mapboxsdk.maps.Telemetry$TelemetryHolder.<clinit>(Telemetry.java:42)
    ... 16 more

I tried different ways but issue doesn't resolved.

tuyen-vuduc commented 4 years ago

@asimwaleed Hi,

Sorry for the inconvenience. Have you searched on Mapbox SDK repo and StackOverflow?

It looks like an issue with native SDK.

Cheers.

asimwaleed commented 4 years ago

i think it's not a native sdk. i have .dll files of Mapbox in my project, How can i update these .dll files to latest version?

asimwaleed commented 4 years ago

i am using visual studio 2019 for xamarin android