Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo Plugins Support › NotificationManager on Android 12

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #24801

    Carlos J Yu

    Hi Felgo Team,

    Recently we released an android application with Android build SDK android-32 which has reported crashing on Android 12 users in NotificationManager, possibly on OneSignal too. When application is on background and receive/schedule a notification, it crashes. I tried possible solution around the internet but the app still crashing. As I understood that we have to consider using FLAG_IMMUTABLE but I have no idea how fix this. Any solution for this error?

    W System.err: java.lang.IllegalArgumentException: com.isakayph.driver: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
    W System.err: Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
    W System.err: 	at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
    W System.err: 	at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
    W System.err: 	at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
    W System.err: 	at net.vplay.plugins.notification.NotificationManagerItem.getPendingIntent(NotificationManagerItem.java:259)
    W System.err: 	at net.vplay.plugins.notification.NotificationManagerItem.scheduleNotification(NotificationManagerItem.java:98)
    W System.err: 	at org.qtproject.qt5.android.QtNative.startQtApplication(Native Method)
    W System.err: 	at org.qtproject.qt5.android.QtNative$7.run(QtNative.java:620)
    W System.err: 	at org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61)
    W System.err: 	at java.lang.Thread.run(Thread.java:920)
    F : java_vm_ext.cc:579] JNI DETECTED ERROR IN APPLICATION: JNI GetMethodID called with pending exception java.lang.IllegalArgumentException: com.isakayph.driver: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
    F : java_vm_ext.cc:579] Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.

     

    Thank you in advance,

     

    #24802

    Günther
    Felgo Team

    Hi Carlos,

    Thank you for your message, we can reproduce the issue and are looking into it.

    I will let you know as soon as I have more information.

    Best,
    Günther

    #24804

    Carlos J Yu

    Hi Günther,

    This is acknowledged, we’ll be waiting for your feedback.

    Thank you,
    <h2></h2>

    #24813

    Günther
    Felgo Team

    Hi Carlos,

    we’ve investigated the problem and applied a fix for the Felgo Notification Plugin. The One Signal Plugin was not affected.

    The fix is already live and applied when rebuilding the application with the latest Android notification plugin, which is integrated via maven in the android/build.gradle:
    implementation 'net.vplay.plugins:plugin-notification:3.+'

    To ensure your Android build downloads and uses the latest version of the notification plugin, please clean the previous plugin from your local maven cache and make a fresh Android build. You can find the cache in the directory “C:\Users\Username\.gradle\caches\modules-2\files-2.1\net.vplay.plugins\plugin-notification” (or on macOS ~/.gradle/caches/files-2.1/net.vplay.plugins/plugin-notification)

    This is only required for local project builds. If you are building the application with Felgo Cloud Builds the correct version is used automatically.

    Let us know in case you encounter any more problems!

    Best,
    Günther

    #24875

    Christian Castro

    Hello Felgo Team.

    We have recently detected the same problem as Carlos, on some Android phones (We are not sure what happens in all of them, personally it happens to me in mine so I have a place to test the problem.) with version 12 and the application in the background, when receiving a message or notification it crashes with exactly the same error that Carlos describes. The tests I have done are:

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation "androidx.appcompat:appcompat:1.2.0"
        implementation 'net.vplay.plugins:plugin-onesignal:3.+'
        // new line
        implementation 'net.vplay.plugins:plugin-notification:3.+'
    }

    Following your instructions, I have added the line and cleared the cache that you mention. But no success, exactly same error. I have tried with android-31, android-32 and android-33 and they all fail. It should be said that in android-30 version it does work, but it is not viable because we have to publish at least with android-31 version. I have also done the following test, create a completely new application with OneSignal, only filling in the variables licenseKey, oneSignalAppId and oneSignalGoogleProjectNumber. With the app in the foreground, I get the notification message signal perfectly, but the moment I bring the new app to the background and send the message again, the app also crashes. I did this test to rule out anything else outside of OneSignal.

    I have also tried to comment the line “implementation ‘net.vplay.plugins:plugin-onesignal:3.+'” and leave the new line, but in that case I see in the console an error that the class cannot be found and then I directly do not receive notifications, just in case I misunderstood and you had to replace one line with another instead of replace.

    And that’s it… Right now I’m stuck and I don’t know what else to try. I have the Felgo installation completely updated, the Android SDK reinstalled from scratch and with the latest updates. Same error in the crash every time.

    I quote the error, which is the same, but just in case they could give you some clue as to what could happen:

    V ActivityThread: scheduleReceiver info = ActivityInfo{2d3ff5e com.onesignal.GcmBroadcastReceiver} intent = Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x1080010 pkg=com.(hidden) cmp=com.(hidden)/com.onesignal.GcmBroadcastReceiver (has extras) } sync = true hasCode = 9157997
    D CompatibilityChangeReporter: Compat change id reported: 160794467; UID 10632; state: ENABLED
    E AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
    E AndroidRuntime: Process: com.(hidden), PID: 10524
    E AndroidRuntime: java.lang.RuntimeException: An error occurred while executing doInBackground()
    E AndroidRuntime: 	at android.os.AsyncTask$4.done(AsyncTask.java:415)
    E AndroidRuntime: 	at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:381)
    E AndroidRuntime: 	at java.util.concurrent.FutureTask.setException(FutureTask.java:250)
    E AndroidRuntime: 	at java.util.concurrent.FutureTask.run(FutureTask.java:269)
    E AndroidRuntime: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
    E AndroidRuntime: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
    E AndroidRuntime: 	at java.lang.Thread.run(Thread.java:1012)
    E AndroidRuntime: Caused by: java.lang.IllegalArgumentException: com.lapalmagranada.la_palma.lapalma: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
    E AndroidRuntime: Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
    E AndroidRuntime: 	at android.app.PendingIntent.checkFlags(PendingIntent.java:378)
    E AndroidRuntime: 	at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:648)
    E AndroidRuntime: 	at android.app.PendingIntent.getBroadcast(PendingIntent.java:635)
    E AndroidRuntime: 	at com.onesignal.GenerateNotification.getNewActionPendingIntent(GenerateNotification.java:195)
    E AndroidRuntime: 	at com.onesignal.GenerateNotification.createGenericPendingIntentsForGroup(GenerateNotification.java:413)
    E AndroidRuntime: 	at com.onesignal.GenerateNotification.showNotification(GenerateNotification.java:377)
    E AndroidRuntime: 	at com.onesignal.GenerateNotification.fromJsonPayload(GenerateNotification.java:116)
    E AndroidRuntime: 	at com.onesignal.NotificationBundleProcessor.ProcessJobForDisplay(NotificationBundleProcessor.java:115)
    E AndroidRuntime: 	at com.onesignal.NotificationExtenderService.processJsonObject(NotificationExtenderService.java:202)
    E AndroidRuntime: 	at com.onesignal.NotificationExtenderService.processIntent(NotificationExtenderService.java:155)
    E AndroidRuntime: 	at com.onesignal.NotificationExtenderService.onHandleWork(NotificationExtenderService.java:123)
    E AndroidRuntime: 	at com.onesignal.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:439)
    E AndroidRuntime: 	at com.onesignal.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:430)
    E AndroidRuntime: 	at android.os.AsyncTask$3.call(AsyncTask.java:394)
    E AndroidRuntime: 	at java.util.concurrent.FutureTask.run(FutureTask.java:264)
    E AndroidRuntime: 	... 3 more
    D OneSignal: onActivityDestroyed: net.vplay.helper.VPlayActivity@9371519
    D OneSignal: curActivity is NOW: null

    I hope you can help me. Thanks in advance.

    #24879

    Alex
    Felgo Team

    Hi Christian,

    just to make sure I can follow you here: Are you experiencing this issue using the OneSignal plugin or the (local) Notification plugin? The mentioned fix was applied to the local notification plugin from what I see. The OneSignal did not appear to be affected be this issue. If you exoerience the issue with the OneSignal plugin, we’ll have to take a closer look there as well.

    Best,
    Alex

    #24880

    Christian Castro

    Hi Alex.

    In fact, my problem is different from the thread, I had not noticed that important little detail. Yes, I can confirm that the problem is with the OneSignal plugin, not with the local notification plugin. The trace is: I start the app on my mobile and connected to see the messages on the console. I send the app to the background and then send a message from our server. The normal execution (android-30) is that I receive the message correctly and I can see it in the notifications section, but if I compile and run with android-31 or higher it is when the crash occurs right at the moment I receive the message. The notification is not displayed at any time, the crash occurs directly and the message is displayed in the console, I quoted it in my previous message. For the record that the failure only occurs in the background, if the app is in the foreground, then I receive the message correctly. Even in a completely new project as I have mentioned in my previous post.

    Thank you very much for your help, Alex.

    #24881

    Alex
    Felgo Team

    Hi Christian,

    thank you for the details. We can confirm the issue and are working on an update for the OneSignal plugin to fix this issue, I will notify you when it is available.

    Best,
    Alex

    #24882

    Alex
    Felgo Team

    Hi Christian,

    we deployed an update to the maven repository. Please clean your local maven cache and perform a new clean build.

    Best,
    Alex

    #24883

    Christian Castro

    Hi Alex.

    I’ve done several tests and now the app doesn’t crash, thank you very much, the update has worked.

    I also comment in case it happened to someone and for information:

    • After cleaning the .gradle cache and deleting the build folder of the project, it failed me that it did not detect the OneSignal class, so I cleaned all the content of the .gradle subfolders, causing gradle to be downloaded again when I went back to compile.
    • It should also be said that the “message” property now contains a json with information, including the message itself when before it only contained the message. The message is now included in the “alert” property.

    Thank you very much for your work, Alex.

    #24884

    Alex
    Felgo Team

    Hi Christian,

    thank you for your report. We pushed another update to maven. This aligns the “message” property behavior with iOS again, so it directly contains the message and not the JSON anymore.

    Please clean the cache again so you receive the update.

    Best,
    Alex

Viewing 11 posts - 1 through 11 (of 11 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded