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.