caffeinalab / ti.goosh

GCM/FCM module for Titanium.
MIT License
52 stars 34 forks source link

Use Android notification channels #120

Open Panda2a opened 5 years ago

Panda2a commented 5 years ago

SDK version : 7.5.0.GA Ti.Goosh version 4.2.0

Hi,

No way to use push notifications with custom sound on android device with android 8.1.

1) I declare a notification channel in the app.js

var channelAlerte = null; if (Ti.Platform.Android.API_LEVEL >= 26) { channelAlerte = Ti.Android.NotificationManager.createNotificationChannel({ id: "channel_alerte", name: "Alertes test", importance: Ti.Android.IMPORTANCE_HIGH, sound: soundPath, enableVibration : true, enableLights : true, description : "Test channel" });

2) I send a push message using FCM with the following payload

{ "registration_ids":["X","Y"], "data":{"data":{ "alert":"My test", "title":"Test", "sound":"dummySound", "idalerte":"327", "android_channel_id":"channel_alerte" } } }

The push notification is received on the device but on the default channel : the default sound is played and not my custom sound

The sound is well positioned in the res/raw folder. On the studio console, i have the ti.Goosh notification "W/ti.goosh.IntentService: Show Notification: TRUE"

Does anybody know where could be the problem ?

Perhaps is the problem coming from the fact that there's no field in Ti.Goosh to detect the notification channel sent in the payload or no way to set the default notification channel sound ?

furthurr commented 5 years ago

https://docs.appcelerator.com/platform/latest/#!/guide/Titanium_SDK_7.5.0.GA_Release_Note

TIMOB-26484 - Android: Add "sound" support to NotificationChannel

Added sound support to NotificationChannel