[TIMOB-25869] Android: Sending Push results in a crash
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-05-24T23:57:33.000+0000 |
Affected Version/s | Release 7.0.2 |
Fix Version/s | Release 7.3.0 |
Components | Android |
Labels | android, gcm, push |
Reporter | Paul Ryan |
Assignee | Yordan Banev |
Created | 2018-03-14T16:12:16.000+0000 |
Updated | 2018-06-22T16:49:36.000+0000 |
Description
sending a push notification from platform.axway.com to an android device using an android specific failure causes the app to crash when in the background. e.g. using the following payload (taken from [here](http://docs.appcelerator.com/platform/latest/#!/guide/Sending_and_Scheduling_Push_Notifications-section-src-43298780_SendingandSchedulingPushNotifications-androidAndroid-specificpayloadfields)) will cause a crash
{
"android": {
"title": "Example",
"alert": "Sample alert",
"icon": "little_star",
"badge": "+2",
"sound": "door_bell",
"vibrate": true
},
"category": "sampleCategory",
"custom_field_1": "Arrow Push Services Rocks!",
"custom_field_2": "Hi Push"
}
The crash is as follows....
03-14 16:06:15.020 19235 19235 E AndroidRuntime: java.lang.RuntimeException: Unable to start receiver com.appcelerator.aps.GCMReceiver: java.lang.IllegalArgumentException: Invalid notification (no valid small icon): Notification(pri=0 contentView=null vibrate=null sound=null tick defaults=0x0 flags=0x10 color=0x00000000 vis=PRIVATE)
03-14 16:06:15.020 19235 19235 E AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:3072)
03-14 16:06:15.020 19235 19235 E AndroidRuntime: at android.app.ActivityThread.-wrap18(ActivityThread.java)
03-14 16:06:15.020 19235 19235 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1580)
03-14 16:06:15.020 19235 19235 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
03-14 16:06:15.020 19235 19235 E AndroidRuntime: at android.os.Looper.loop(Looper.java:154)
03-14 16:06:15.020 19235 19235 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6186)
03-14 16:06:15.020 19235 19235 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
03-14 16:06:15.020 19235 19235 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
03-14 16:06:15.020 19235 19235 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
Hey there! It looks like an issue in the configuration of your notification, not Titanium itself. See the error: {quote} Invalid notification (no valid small icon): Notification(pri=0 contentView=null vibrate=null sound=null tick defaults=0x0 flags=0x10 color=0x00000000 vis=PRIVATE) {quote} You can fix it by adding the icon to your payload or via the [
icon
property](http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Android.Notification-property-icon) when being using in notifications triggered from the app.[~paulatstepup], Did you manage to follow as suggested earlier?
see the above payload - the icon property is present
Also, I only get this error if I send via ACS, I don't get the error if I send directly to GCM
Hey [~paulatstepup], thanks for your feedback! I thought it needs the extension suffix, but likely it doesn't. Checking with [~ybanev] if he knows some details! In the meantime, please add your environment (TiSDK-version, Android version) as its impossible to validate this right now.
as requested... appc version 7.0.2 ti sdk 7.0.2.GA target sdk 26 min sdk 21 android build tools 26.0.3 error seen on Android 7.1 and Android 8.1 devices (not tested on any others) PS I have retried using the icon property in the android object and in the top level object. It made no difference
Ti.cloudpush: https://github.com/appcelerator-modules/cloudpush/pull/39 aps_sdk: https://github.com/appcelerator/aps_sdk/pull/310
Verified the fix in ti.cloudpush 5.1.2. Closing.