Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Local Notifications on Android 8.0 Oreo

Discussion in 'Android' started by trdinich, Sep 28, 2017.

  1. trdinich

    trdinich

    Joined:
    Oct 5, 2016
    Posts:
    9
    Android 8.0 has some changes to their notifications infrastructure [0], and is now causing crashes in the plugin I'm using (Stan's assets [1]). That asset is really bad and I've been hoping to migrate away from it for awhile now, but can't seem to find anything else to properly handle notifications either.

    Does anyone know of any notifications plugins that work properly on Android 8.0 Oreo? The other one I often see is Agasper's project on GitHub [2], but that only claims compatibility through Android 7.1.

    For reference, here is the crash I'm seeing consistently on Oreo devices:

    java.lang.RuntimeException:
    at android.app.ActivityThread.handleReceiver (ActivityThread.java:3259)
    at android.app.ActivityThread.-wrap17 (Unknown Source)
    at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1677)
    at android.os.Handler.dispatchMessage (Handler.java:105)
    at android.os.Looper.loop (Looper.java:164)
    at android.app.ActivityThread.main (ActivityThread.java:6541)
    at java.lang.reflect.Method.invoke (Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:240)
    at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:767)

    Caused by: java.lang.IllegalStateException:
    at android.app.ContextImpl.startServiceCommon (ContextImpl.java:1505)
    at android.app.ContextImpl.startService (ContextImpl.java:1461)
    at android.content.ContextWrapper.startService (ContextWrapper.java:644)
    at android.content.ContextWrapper.startService (ContextWrapper.java:644)
    at com.androidnative.features.notifications.LocalNotificationReceiver.onReceive (LocalNotificationReceiver.java:44)
    at android.app.ActivityThread.handleReceiver (ActivityThread.java:3252)


    My native Android is experience is reasonably limited, but I am comfortable there if any Android devs have some insight into what I may need to change in the plugin.

    Thanks for the help,
    Joe

    [0] https://developer.android.com/about/versions/oreo/android-8.0-changes.html
    [1] https://www.assetstore.unity3d.com/en/#!/content/10825
    [2] https://github.com/Agasper/unity-android-notifications
     
  2. KrcKung

    KrcKung

    Joined:
    Jul 18, 2017
    Posts:
    53
    I'm using the latest Stans plugin and having the same problems. So far, I sort of gave up on them ( contact them and they tell me that they don't have android 8.0 device to test it since their country didn't received the android 8.0 update yet ) and plan to migrate the whole framework to another one.
     
  3. 3gogames

    3gogames

    Joined:
    Jul 28, 2015
    Posts:
    31
  4. trdinich

    trdinich

    Joined:
    Oct 5, 2016
    Posts:
    9
    I have been in contact with them about the issue and got the same response that KrcKung got.

    To be honest... I've come to the conclusion that their plugins just aren't viable for use in the real world if you're trying to build an app that will work across all devices and versions. I've had to personally fix a few bugs already in both their Android and iOS plugins and their stuff has generally been a nightmare. I'm going to move on to a different solution for native plugins unfortunately.

    If anyone knows of good plugins for native notifications that offer the ability to get the notification callback data when clicked, I'm all ears! In the meantime, I'm going to use built in Unity stuff for iOS and Agasper's plugin for Android.
     
  5. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,827
    Our plugin(Cross Platform Native Plugins) is ready to hit the asset store in couple of days with Oreo update. (This update includes notification fixes)

    Will update here as soon as its approved by asset store.

    Edit : It was pushed to asset store last month :)

    Thanks,
    VB Team
     
    Last edited: Dec 19, 2017
  6. lolchampionmanager

    lolchampionmanager

    Joined:
    Mar 15, 2017
    Posts:
    2
    Hi!

    As trdinich has said in his first comment, a few days ago I decided to fork the project of Agasper's project and I fixed the original source plugin to allow use the local notifications in Android 8 Oreo.

    https://github.com/samuelfa/unity-android-notifications

    I'm using the plugin in our game with the future version and works correctly in every version of Android.

    In the link you can find the plugin compress with aar extension (is a zip file) with our custom icon but you can clone the project and change it. On another hand, you can compile the plugin again using gradle (inside the plugin source you can find a bat file to use it with the command pluginCreate.
     
  7. andrew-rc

    andrew-rc

    Joined:
    Jun 20, 2013
    Posts:
    10
    We have the exact same problem. Currently waiting on a response from Stans.
    We haven't seen any actual crashes yet on our Oreo devices (and our users haven't really reported problems that seem related), but this error is everywhere in the Google Play Console Vitals section, and am reasonably worried about it.
     
    Last edited: Dec 19, 2017
  8. trdinich

    trdinich

    Joined:
    Oct 5, 2016
    Posts:
    9
    Do you know if your Oreo users are actually getting notifications? My understanding of the problem is that the crash is happening when they're being scheduled, and thus they never get scheduled with the OS properly and don't actually fire.
     
  9. andrew-rc

    andrew-rc

    Joined:
    Jun 20, 2013
    Posts:
    10
    We're not even really using local notifications, that's the thing. We're using Stans for a dialogue popup asking the user to rate the game, and for Google Play integration (achievements, cloud save, login), but that's it.

    Right now we're not sure what's causing the error at all.
     
  10. KrcKung

    KrcKung

    Joined:
    Jul 18, 2017
    Posts:
    53