Estimote / Android-Fleet-Management-SDK

Estimote Fleet Management SDK for Android
https://developer.estimote.com
MIT License
836 stars 451 forks source link

IllegalStateException: Not allowed to start service in background #277

Closed gajicm93 closed 5 years ago

gajicm93 commented 6 years ago

Prerequisites

Basic information

Estimote SDK version: 1.4.1

Android devices affected: Galaxy S8

Android OS version affected: Android 8.0

Beacon hardware version: Will check tomorrow

Description

Got this crash from Crashlytics in the wild, can't reproduce it myself. But this is a well known change for Android Oreo, where you can no longer start services from background. Read more here. My app targets API 27.

Expected behavior: not to crash

Actual behavior: crashes

Logs and code

Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.estimote.coresdk.scanning.scheduling.SystemAlarmManager$AlarmBroadcastReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.coke.tastly/com.estimote.coresdk.service.BeaconService }: app is in background uid UidRecord{fd37547 u0a189 RCVR bg:+1m0s285ms idle procs:1 seq(36,36,36)}
       at android.app.ActivityThread.handleReceiver(ActivityThread.java:3397)
       at android.app.ActivityThread.-wrap18(Unknown Source)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1780)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6938)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
iernie commented 6 years ago

I am also seeing this crash popup from some users. Huawei and Samsung devices.

gajicm93 commented 6 years ago

Is there any ETA for the fix?

mihir-elite commented 6 years ago

Hello,

i'm facing the same issue, any resolution on this ?

pawelDylag commented 6 years ago

Hello guys,

This problem affects phones with Android 8.0+ I suppose. This SDK is no longer being maintained, thus there is no support for Oreo+ phones in it. I really encourage you to switch to our currently being developed ProximitySDK 🚀 - it supports all Android devices since 5.0, and is well prepared for background-work changes introduced in Android 8.0. Plus the API is way easier to use and lets you avoid many common mistakes - such as wrong states, or BLE errors. :)

Regards, Paweł

heypiotr commented 5 years ago

[Cleaning up stale issues following the rebranding of Estimote SDK to Estimote Fleet Management SDK]

As Pawel mentioned, for proximity detection (enter/exit events), we're asking developers to migrate to our Proximity SDK:

https://developer.estimote.com/proximity/android-tutorial/

If you need any help with the migration, let us know on our forums:

https://forums.estimote.com