0
votes

As per new android policy, we have set target SDK as 26 (API Level 26) in my cordova app. After this, android oreo devices are not receiving any push notifications sent from AWS SNS using GCM.

On searching over SO, it looks like we need to set android_channel_id some string value in the message payload. Even after doing that, messages are not received in Android Oreo devices. I tried to send directly from AWS SNS console as well as through our Java Spring REST API using SNSClient PublishRequest.

Do we need to create notification channels using AWS SNS client in Java? If so, any sample code using AWS SNS PublishRequest available? Or, just changes to be done in message payload? Could anyone help on this? Thanks.

1
Use NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, notificationId); instead of NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(notificationId); - Ashish Kumar
@AshishKumar, actually its not a native android app. It's a hybrid app using ionic framework. The push notifications are sent from Java Spring API using AWS SNS SNSClient.PublishRequest - Technoster
At least, if we know the latest message payload for android oreo devices, which really worked for anyone using AWS SNS console, we can use that payload in API - Technoster

1 Answers

0
votes

Just discovered that the theoretical solution would be to upgrade phonegap push plugin above 2.1.0 which creates default notification channels.

But in order to upgrade push plugin, we may have to upgrade cordova-android version (>= 7.1.0) and all other plugins may throw incompatibility errors which can be resolved by upgrading those plugins.