I encountered the following problem when adding notifications to a Unity app involving Wikitude running on an Android device:
1) Open the app
2) Press the Home button to pause the app/put it in the background
3) Send a notification to the app
4) Click on the notification to bring the app to the forefront
> The app crashes and needs to be restarted
This is related to some interaction between notifications and WikitudeActivity referenced in the AndroidManifest.xml file. To investigate, I trimmed the app so there was a single, simple scene with only UI, the notification handling code, and no wikitude usage. The problem still occurred until I replaced the WikitudeActivity in the AndroidManifest.xml file with the standard UnityPlayerActivity.
Also, the following similar scenarios appear to work fine:
- In step 2, close the app instead of putting in the background.
- Pause the app and then return to it without sending a notification
- In iOS, the same scenario works fine
I'm working with the following versions:
Wikitude Unity Plugin: 7.1.0
Android: 7.0 on Samsung Galaxy S7 and 4.4.2 on HTC
Notifications package: UTNotifications from the Unity Asset Store
Anyone know a way to avoid this? Or has anyone seen something similar?
Here are more details on how the app is being notified in this scenario:
When the user clicks on a notification, the following code is being used to activate the application (on Android):
final PackageManager packageManager = context.getPackageManager();
final Intent mainActivityIntent = packageManager.getLaunchIntentForPackage(this.getApplicationContext().getPackageName());
With other Activity classes, this works fine, but the WikitudeActivity crashes. The following is in the LogCat output:
01-29 23:55:46.220 2393 4429 E ActivityTrigger: activityResumeTrigger: not whiteListeduniversal.tools.notificationsexample/com.wikitude.unity.WikitudeActivity/1
01-29 23:55:46.382 18630 18792 F libc : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 18792 (UnityMain)
More of the log output is in the attached file.
Thank you for sending the log as well. Can you please check if UTNotifications needs some configuration to make it work with non-standard activities? If that doesn't solve your problem, can you send us the simplified project you created for testing at email@example.com, so that I can debug it locally?