flutter_background_geolocation icon indicating copy to clipboard operation
flutter_background_geolocation copied to clipboard

Android Bad notification for startForeground crash

Open choim4389 opened this issue 1 year ago • 4 comments

Your Environment

  • Plugin version: 4.9.0
  • Platform: Android
  • OS version: 13
  • Device manufacturer / model: Galaxy S20
  • Flutter info (flutter doctor):
  • Plugin config:
E/AndroidRuntime(27756): android.app.RemoteServiceException$CannotPostForegroundServiceNotificationException: Bad notification for startForeground
E/AndroidRuntime(27756): 	at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:2222)
E/AndroidRuntime(27756): 	at android.app.ActivityThread.-$$Nest$mthrowRemoteServiceException(Unknown Source:0)
E/AndroidRuntime(27756): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2508)
E/AndroidRuntime(27756): 	at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(27756): 	at android.os.Looper.loopOnce(Looper.java:226)
E/AndroidRuntime(27756): 	at android.os.Looper.loop(Looper.java:313)
E/AndroidRuntime(27756): 	at android.app.ActivityThread.main(ActivityThread.java:8757)
E/AndroidRuntime(27756): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(27756): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
E/AndroidRuntime(27756): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
E/TSLocationManager(27756): [c.t.l.a.BackgroundGeolocation$w0 uncaughtException] 
E/TSLocationManager(27756):   ‼️  Uncaught Exception: Bad notification for startForeground

I don't know how to reproduce this, but it rarely crashed by Bad notification for startForeground.

When can this situation happen?

choim4389 avatar Mar 09 '23 03:03 choim4389

Your app is likely missing an expected app icon file.

christocracy avatar Mar 09 '23 14:03 christocracy

@christocracy I've been using small icon like below and it works.

bg.Notification(
      channelId: 'my_channel_id',
      title: myTitle,
      text: myContent,
      smallIcon: 'drawable/img_noti_small'
    )

Is largeIcon required too?

choim4389 avatar Mar 10 '23 04:03 choim4389

Is largeIcon required too?

No.

christocracy avatar Mar 10 '23 13:03 christocracy

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar May 06 '24 01:05 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar May 20 '24 01:05 github-actions[bot]