{ "id": "171664", "key": "MOD-2429", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10034", "key": "MOD", "name": "Appcelerator Modules", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2019-12-20T18:27:48.000+0000", "created": "2018-05-16T19:34:18.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "arrow", "push" ], "versions": [], "issuelinks": [ { "id": "56570", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "170793", "key": "MOD-2387", "fields": { "summary": "Android cloudpush : Custom sound is not played", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "None", "id": "6" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "updated": "2019-12-20T18:27:54.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "12140", "name": "CloudPush" } ], "description": "Titanium 7.1.1.GA\r\n\r\nWhen sending Arrow Push notifications with a custom sound file to an Android device running Android 8 or above, the sound is not found and depending on the status of the app (foreground or background, the app either only plays the device default sound, or crashes the app.\r\n\r\nA sample payload:\r\n\r\n{code}\r\n{\r\n \"alert\": \"My Alert Text\",\r\n \"icon\": \"q\",\r\n \"badge\": \" 1\",\r\n \"sound\": \"popq.wav\",\r\n \"vibrate\": \"false\",\r\n \"title\": \"My Title\",\r\n \"priority\": \"high\",\r\n \"content-available\": 0\r\n}\r\n{code}\r\n\r\nThe sounds are located at:\r\n/resources/popq.wav (For iOS)\r\n/resources/sound/popq.wav (for Android)\r\n\r\nNote: The docs state to specify the sound without the extension. However, I am only able to get the push notification custom sounds to work on both Android and iOS WITH the extension specified. If you do not specify an extension, then you get the default notification sound on both Android and iOS. I am using WAV because that sound format is supported by both Android and iOS. Icon works fine with not including the extension.\r\n\r\nWith app in foreground:\r\n{code}\r\n[WARN] : W/System.err: java.io.FileNotFoundException: /sdcard/cocoafish/sound/com.walkthelot.qalerts/popq.wav (No such file or directory)\r\n[WARN] : W/System.err: \tat java.io.FileOutputStream.open0(Native Method)\r\n[WARN] : W/System.err: \tat java.io.FileOutputStream.open(FileOutputStream.java:287)\r\n[WARN] : W/System.err: \tat java.io.FileOutputStream.(FileOutputStream.java:223)\r\n[WARN] : W/System.err: \tat java.io.FileOutputStream.(FileOutputStream.java:110)\r\n[WARN] : W/System.err: \tat com.appcelerator.aps.APSCloudPush.getAndTransferFile(APSCloudPush.java:544)\r\n[WARN] : W/System.err: \tat com.appcelerator.aps.APSCloudPush.showTrayNotification(APSCloudPush.java:443)\r\n[WARN] : W/System.err: \tat com.appcelerator.aps.APSCloudPush.receivePayload(APSCloudPush.java:269)\r\n[WARN] : W/System.err: \tat com.appcelerator.aps.GCMReceiver.onReceive(GCMReceiver.java:30)\r\n[WARN] : W/System.err: \tat android.app.ActivityThread.handleReceiver(ActivityThread.java:3187)\r\n[WARN] : W/System.err: \tat android.app.ActivityThread.-wrap17(Unknown Source:0)\r\n[WARN] : W/System.err: \tat android.app.ActivityThread$H.handleMessage(ActivityThread.java:1672)\r\n[WARN] : W/System.err: \tat android.os.Handler.dispatchMessage(Handler.java:106)\r\n[WARN] : W/System.err: \tat android.os.Looper.loop(Looper.java:164)\r\n[WARN] : W/System.err: \tat android.app.ActivityThread.main(ActivityThread.java:6494)\r\n[WARN] : W/System.err: \tat java.lang.reflect.Method.invoke(Native Method)\r\n[WARN] : W/System.err: \tat com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)\r\n[WARN] : W/System.err: \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)\r\n[WARN] : Notification: Use of stream types is deprecated for operations other than volume control\r\n[WARN] : Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case\r\n{code}\r\nWhen app is closed I get an Android error that APP Name has stopped, and no notification comes through.\r\n\r\nThis all works flawlessly on iOS and any Android device running Android API 25 or LOWER. The app is in production on both iOS and Android stores. For Android installations greater than API 25 I just disable the option for the user to choose a custom sound.", "attachment": [], "flagged": false, "summary": "Arrow Push Custom Notification Sounds for Android 8+ Not Found", "creator": { "name": "ken@walkthelot.com", "key": "ken@walkthelot.com", "displayName": "Ken Rucker", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "ken@walkthelot.com", "key": "ken@walkthelot.com", "displayName": "Ken Rucker", "active": true, "timeZone": "America/New_York" }, "environment": "Android SDK 26 and above.", "comment": { "comments": [ { "id": "438124", "author": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "body": "APS_SDK: https://github.com/appcelerator/aps_sdk/pull/320", "updateAuthor": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "created": "2018-06-05T14:50:49.000+0000", "updated": "2018-06-05T14:50:49.000+0000" }, { "id": "440515", "author": { "name": "mas945846", "key": "mas945846", "displayName": "Michael Scholz", "active": true, "timeZone": "America/New_York" }, "body": "Any status/progress update on this issue?", "updateAuthor": { "name": "mas945846", "key": "mas945846", "displayName": "Michael Scholz", "active": true, "timeZone": "America/New_York" }, "created": "2018-08-06T18:43:17.000+0000", "updated": "2018-08-06T18:43:17.000+0000" }, { "id": "440517", "author": { "name": "ken@walkthelot.com", "key": "ken@walkthelot.com", "displayName": "Ken Rucker", "active": true, "timeZone": "America/New_York" }, "body": "Sadly, I know I haven't heard zip and the latest SDK's have not fixed it.", "updateAuthor": { "name": "ken@walkthelot.com", "key": "ken@walkthelot.com", "displayName": "Ken Rucker", "active": true, "timeZone": "America/New_York" }, "created": "2018-08-06T18:48:45.000+0000", "updated": "2018-08-06T18:48:45.000+0000" }, { "id": "440518", "author": { "name": "mas945846", "key": "mas945846", "displayName": "Michael Scholz", "active": true, "timeZone": "America/New_York" }, "body": "I'm wondering if other modules like Ti.goosh has this issue resolved. I was testing with it and it worked well in many regards. I did not check for this issue specifically. I have seen a related issue posted back in March 2018. It has been 6 months.", "updateAuthor": { "name": "mas945846", "key": "mas945846", "displayName": "Michael Scholz", "active": true, "timeZone": "America/New_York" }, "created": "2018-08-06T18:51:15.000+0000", "updated": "2018-08-06T18:51:15.000+0000" }, { "id": "441440", "author": { "name": "ken@walkthelot.com", "key": "ken@walkthelot.com", "displayName": "Ken Rucker", "active": true, "timeZone": "America/New_York" }, "body": "I doubt it since the issue is related to basically having permissions/access to the custom sound file in the Android app container.", "updateAuthor": { "name": "ken@walkthelot.com", "key": "ken@walkthelot.com", "displayName": "Ken Rucker", "active": true, "timeZone": "America/New_York" }, "created": "2018-09-10T15:55:44.000+0000", "updated": "2018-09-10T15:55:44.000+0000" }, { "id": "442224", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I'll ask the test team to re-test, but I suspect this issue still exists when running on Android 7.0 and above. It's due to a breaking-change that Google has made where external apps need to be given permission to read another app's files.\r\nhttps://developer.android.com/about/versions/nougat/android-7.0-changes#sharing-files\r\n\r\nThe problem here is that their is a design issue on Google's end where there is no way to grant the system permission without using *hack* (grant it to Google's \"com.android.systemui\" system app), which is not guaranteed to work on all devices and OS versions.\r\n\r\nYou can see Google's bug reports on this issue below. Supposedly they fixed it in Android 9.0, but we would have to see if the issue is still outstanding in Android 7.0 - 8.x.\r\nhttps://issuetracker.google.com/issues/36524161\r\nhttps://issuetracker.google.com/issues/37118905\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-10-02T18:55:47.000+0000", "updated": "2018-10-02T18:55:47.000+0000" }, { "id": "444239", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The issue is that Google has made a breaking change in Android 8.0 and above. You can no longer assign a sound to individual notifications. Instead, you must configure a \"notification channel\" with a sound and assign that notification the ID to that notification channel. We've added notification channel \"sound\" support in 7.5.0. Please see...\r\nhttps://docs.appcelerator.com/platform/latest/#!/api/Titanium.Android.NotificationChannel-property-sound\r\n\r\nThe test procedure and code example attached to the below pull request shows you how to set up a notification channel with sound. While it's an example for a local notification, you still need to create a channel yourself for push notification as well within your app. Arrow can't do this for you. The key thing is you need to assign the notification channel a name, channel ID, importance level, and path to the sound file.\r\nhttps://github.com/appcelerator/titanium_mobile/pull/10400\r\n\r\nThe channel ID string you set up is important. You need to apply this channel ID to your remote notification JSON so that the Android side knows which channel to assign it to. If you don't assign it a channel ID, then it ends being posted to a default channel, which is what is happening to you now.\r\n\r\nFor example, if your notification channel ID is {{\"my_channel_1\"}}, then your Arrow JSON needs to be the below...\r\n{code:json}\r\n{\r\n\t\"android\": {\r\n\t\t\"title\": \"My Title\",\r\n\t\t\"alert\": \"My alert message.\",\r\n\t\t\"channelId\": \"my_channel_1\"\r\n\t}\r\n}\r\n{code}\r\n\r\nUnder the JSON's {{\"android\"}} table, the {{\"channelId\"}} is where you put the notification channel ID string.\r\n\r\nAlso note that the above only applies to Android 8.0 and above. Older Android OS versions do not support notification channels and you still have to apply a sound to individual notifications for it to work on older systems. Unfortunately, you have to do it both ways. That's how Google has made it, not us.\r\n\r\nI hope this helps.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-12-04T19:32:52.000+0000", "updated": "2018-12-04T19:32:52.000+0000" } ], "maxResults": 15, "total": 15, "startAt": 0 } } }