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

App being crashed: yukams.app.background_locator_2.IsolateHolderService.getNotification #118

Open
thebeliever18 opened this issue Feb 4, 2024 · 4 comments

Comments

@thebeliever18
Copy link

Hello,

In flutter,
I have used workmanager and background_locator_2 and stored location co-ordinates in sharedpreference
workmanager calls function of background_locator_2 in every 15 mins
background_locator_2 stores the location co-ordinates in every 5 mins
when app is terminated both workmanager and background_locator_2 both of them are working properly.
But after some days My app is being crashed and sending reports as:
yukams.app.background_locator_2.IsolateHolderService.getNotification
java.lang.IllegalArgumentException
Exception java.lang.RuntimeException:
at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:4804)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2266)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loopOnce (Looper.java:201)
at android.os.Looper.loop (Looper.java:288)
at android.app.ActivityThread.main (ActivityThread.java:8061)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:703)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:923)
Caused by java.lang.IllegalArgumentException:
at android.os.Parcel.createExceptionOrNull (Parcel.java:3021)
at android.os.Parcel.createException (Parcel.java:3001)
at android.os.Parcel.readException (Parcel.java:2984)
at android.os.Parcel.readException (Parcel.java:2926)
at android.app.INotificationManager$Stub$Proxy.createNotificationChannels (INotificationManager.java:3563)
at android.app.NotificationManager.createNotificationChannels (NotificationManager.java:935)
at android.app.NotificationManager.createNotificationChannel (NotificationManager.java:923)
at yukams.app.background_locator_2.IsolateHolderService.getNotification (IsolateHolderService.java)
at yukams.app.background_locator_2.IsolateHolderService.start (IsolateHolderService.java)
at yukams.app.background_locator_2.IsolateHolderService.startHolderService (IsolateHolderService.java)
at yukams.app.background_locator_2.IsolateHolderService.onStartCommand (IsolateHolderService.java)
at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:4786)

This error is mostly occuring in android version 11,12 and 13.
Please provide the solution.
Thanks

@ramazancopur
Copy link

Are you sure that app notification permission is granted?

@thebeliever18
Copy link
Author

thebeliever18 commented Feb 7, 2024

Hello, @ramazancopur thanks for replying.
Yes I have added notification permission.
In this way.

FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
      FlutterLocalNotificationsPlugin();
  flutterLocalNotificationsPlugin
      .resolvePlatformSpecificImplementation<
          AndroidFlutterLocalNotificationsPlugin>()
      ?.requestPermission();

requestPermission() here asks for the permission.

For Android 13 and higher we now need to add.

<manifest ...>
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
    <application ...>
        ...
    </application>
</manifest>

According to official android documentation: (https://developer.android.com/develop/ui/views/notifications/notification-permission),
which I had not added earlier, but after seeing your comment I reviewed my code and added POST_NOTIFICATIONS permission in my AndroidManifest.xml file for Android 13 and higher.

For the versions below Android 13 requestPermission() is working fine.

I have uploaded the app in play store after adding POST_NOTIFICATIONS permission, will check the data of firebase crashlytics and will notify you soon.

Your comment was really helpful.
Thanks,

@ranahyder87
Copy link

@thebeliever18 Did POST_NOTIFICATIONS permission resolve your issue?

@rodrideveloper
Copy link

The same issue I have, resolved it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants