Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Notification Channel / Category in Android 8.0
Started by yosu Jan 14 2019 05:41 PM

2 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

yosu

[GLOBAL: userInfoPane.html]
yosu
  • Contributor

  • 519 posts
  • Corona SDK

Hi guys,

 

This new feature in Android 8.0 (API level 26) where notification can be handled as channels (aka category). Currently, in the app, the 'category' is corona (see attached screen shot).

 

I have tried sending a notification message (using FCM) with the 'android_channel_id' field, but it does not show. I think the push notification plugins needs to be updated or maybe the app needs to create the category first (as per FCM's document).

The app must create a channel with this channel ID before any notification with this channel ID is received.
If you don't send this channel ID in the request, or if the channel ID provided has not yet been created by the app, FCM uses the channel ID specified in the app manifest.
// Sample post-data to FCM
$postData = [
  'registration_ids' => $listOfFcmIds,
  'data' => [
             'alert'=> 'Notification Message',
             'custom' => $myData,
   ]
];

 

 

Reference documents :

https://developer.android.com/guide/topics/ui/notifiers/notifications#ManageChannels

https://firebase.google.com/docs/cloud-messaging/http-server-ref

 

 

 

Any advice on how to create the channels/category in the app using Corona ?

 

 

 

Thanks



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,648 posts
  • Enterprise

I'm checking with Engineering about this.



[TOPIC: post.html]
#3

vlads

[GLOBAL: userInfoPane.html]
vlads
  • Contributor

  • 669 posts
  • Corona Staff

This field is optional, please skip it.

 

For local notifications Corona uses channel with id "com.coronalabs.defaultChannel" and tag "corona", created when first local notification is posted.

 

If you want to mass-send notifications consider using topics subscriptions with notifications.subscribe/unsubscribe functions.




[topic_controls]
[/topic_controls]