Appcelerator Android Push with AWS SNS - titanium

I'm developing an app for both iOS and Android.
We're using AWS SNS for Push Notifications.
iOS runs fine, but for Android I receive a push event but the payload is empty no matter what we try in SNS. (Have tried to push via Arrow and it works fine, so it feels like a problem in SNS)
Is there anybody out there who have done the same and got it to work?

The solution is to put the payload inside the data object.
"data":{
"payload":{
"android": {
"alert": "This is a message from my own server"
}
}
}
source of solution

Related

How to handle push notification when application is killed

Pardon me if this question has been asked before, I just couldn't find the answer.
I have an react native application, it has calling feature using .Net Core SignalR (For signalling) and webRTC for actual calling. There are three scenarios out of which my application works fine in two scenarios:
Application is in foreground: For this I simply inform other client that X is calling you (using signals from SignalR).
Application is in background: For this I send push notification to the client which is read by the application (notification listener) which in turns opens up the call accept/decline window.
I am struggling with scenario 3:
Application has been killed (from recent apps etc.) and is now not in background in this scenario I only receive the push notification but call windows doesn't open but if I open up that notification I can see the calling window as intended. I need a solution which will open up the calling window automatically just like it does in scenario 1 & 2. How can I listen to push notifications when the application is dead? So that I can show the call window?
I am looking for a solution that would preferably work both on Android and iOS and I am using FCM Push notifications. I am also open to solutions other than push notifications as long as they work correctly.
For supporting to android and iOS you can use
import messaging from "#react-native-firebase/messaging";
messaging().setBackgroundMessageHandler(async (remoteMessage) => {
// handle your notification message here
}

Push notifications using ConnectyCube on React Native

I'm trying to using push notifications using ConnectyCube on React Native. Main problem is that if I send a notification from the admin panel of ConnectyCube (or from source code), the admin panel says that the notification has been successfully delivered, but nothing happens on the android emulator. Maybe someone can think that there are some bugs client-side in the implementation of my onMessageListener:
notificationListener = firebase.notifications().onNotification((notification) => {
console.log("Hi!")
});
Anyway, if I try to send a notification through the Firebase console, all works and I receive the notification. Can you help me?
It seems that you are using a wrong method: https://rnfirebase.io/docs/v5.x.x/notifications/introduction
The React Native Firebase Notifications Module deals with notification-only and notification + data FCM remote messages.
For data-only FCM messages please see the Messaging module.
ConnectyCube sends a data push messages.
Therefore, please try using Messaging module according to this guide:
https://rnfirebase.io/docs/v5.x.x/messaging/receiving-messages

Different sound to play while receiving notifications in expo

I want to play some other sound like an alert one on receiving a notification.Is it possible yet as it is the most basic functionality?Below is my code:
const receipts = expo.sendPushNotificationsAsync([ { to: userObj.pushToken,
sound: 'default', body: notification, data: { withSome: notification }, priority: 'high' } ]);
Expo push server does not support custom sounds. It will swallow whatever you place in the sound field and replace it with default. Attempting to work around their module using the expo service from curl will give you an actual error.
However, custom sounds are possible in expo clients when using your own APNS module server side if the sound is bundled within the .ipa upon delivery to App Store.

Silent background push on iOS and Android

I am using GCM to deliver notifications to Android and iOS devices.
What I am looking for is to send in the same downstream message a silent push for both platforms.
I have tried with this message
"content_available":true,
"data":
{
//My data here
},
As you can see, no notification key is sended, iOS works fine and we are receiving push in the background but Android shows my app icon at the top bar and it is not calling the GCM receiver.
If I set content_available to false, Android works fine but not in iOS (either background or foreground).
What I supposed to do? Send to my server the OS of each device and send a different message for each system?
I have also tried to set aps dictionary in data payload, but still the same.
Thanks in advance.

android gcm push doesn't work with json tag notification

I create an android gcm client. I read this guide:
https://developers.google.com/cloud-messaging/android/client and i use this example https://github.com/googlesamples/google-services/tree/master/android/gcm
My app workes, it receives Push but only when our server application sends json with "data payload".. when our server sends json message with notification payload my android app does'nt receive push.
I read: "Use notifications when you want GCM to handle displaying a notification on your Android client app’s behalf," but it doesn't work in Android...
From what I can guess, you probably just don't have the icon key in your json which is required for Android but not for iOS, try to add something like "icon" : "#drawable/myIcon.png" in your notification dictionary. (I would have asked for a sample of your Json in the comment instead of guessing if I could but I'm still pretty new and can't comment everything yet).