Skip to content
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

android_alarm_manager: "Background start not allowed" #26846

Closed
opensourcegps opened this issue Jan 21, 2019 · 4 comments · Fixed by flutter/plugins#1129
Closed

android_alarm_manager: "Background start not allowed" #26846

opensourcegps opened this issue Jan 21, 2019 · 4 comments · Fixed by flutter/plugins#1129

Comments

@opensourcegps
Copy link

@opensourcegps opensourcegps commented Jan 21, 2019

Steps to Reproduce

  1. Install and run android_alarm_manager example on API 27+
    https://github.com/flutter/plugins/tree/master/packages/android_alarm_manager/example

  2. Kill the app to test background service.

Logs

1-21 10:39:26.345  1643  1699 W ActivityManager: Background start not allowed: service Intent { flg=0x4 cmp=io.flutter.plugins.androidalarmmanagerexample/io.flutter.plugins.androidalarmmanager.AlarmService (has extras) } to io.flutter.plugins.androidalarmmanagerexample/io.flutter.plugins.androidalarmmanager.AlarmService from pid=-1 uid=10082 pkg=io.flutter.plugins.androidalarmmanagerexample

✓] Flutter (Channel stable, v1.0.0, on Linux, locale en_US.UTF-8)
    • Flutter version 1.0.0 at /home/flutter/flutter_v1.0.0-stable
    • Framework revision 5391447fae (7 weeks ago), 2018-11-29 19:41:26 -0800
    • Engine revision 7375a0f414
    • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android SDK at /home/android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = /home/android/sdk
    • Java binary at: /home/android/src/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

[✓] Android Studio (version 3.2)
    • Android Studio at /home/android/src/android-studio
    • Flutter plugin version 31.1.1
    • Dart plugin version 181.5656
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[✓] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)

• No issues found!

Same bug as this one: #16719
It was closed by bot without fixing.

@Hixie

This comment has been minimized.

Copy link
Contributor

@Hixie Hixie commented Jan 23, 2019

cc @bkonyi

@ayush221b

This comment has been minimized.

Copy link

@ayush221b ayush221b commented Jan 25, 2019

Hi. Is there any update on this? I am facing the same issue.

@bkonyi

This comment has been minimized.

Copy link
Contributor

@bkonyi bkonyi commented Jan 25, 2019

Hi @ayush221b,

Sorry for the delay. I've had a few other things on my plate but I'll be looking at this shortly. Thanks for your patience!

@bkonyi

This comment has been minimized.

Copy link
Contributor

@bkonyi bkonyi commented Jan 28, 2019

android_alarm_manager was still using a Service to handle alarm events in the background, which unfortunately causes issues on Android 8+ due to background execution restrictions. I've updated the plugin to make use of a BroadcastReceiver and JobIntentService instead which should conform to the background execution restrictions.

Once flutter/plugins#1129 is approved and merged, I'll release android_alarm_manager 0.4.0. On upgrading, the AndroidManifest.xml will need to be updated with the following:

      <service
          android:name="io.flutter.plugins.androidalarmmanager.AlarmService"
          android:permission="android.permission.BIND_JOB_SERVICE"
          android:exported="false"/>
      <receiver
          android:name="io.flutter.plugins.androidalarmmanager.AlarmBroadcastReceiver"
          android:exported="false"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.