aws-mobile-ionic-sample
aws-mobile-ionic-sample copied to clipboard
Not receiving push notifications outside of the app
I have followed https://aws.amazon.com/blogs/mobile/push-notifications-with-ionic-and-amazon-pinpoint/ and am receiving in-app notifications when sending via "direct" in the AWS console, but when the app is in the background or closed, no notifications come through. Any ideas why?
I have same problem. Any solution?
same problem here !
I also ran into this. It only appears to affect Android for me - iOS apps receive notifications while the app is in background mode no problem.
Anyone figure this out yet? Any insight would be definitely appreciated!
same problem here
We had the same problem and we solve it for android background mode. Solution:
- Do not use FCM, use GCM. So, install the ionic push plugin v1 not v2.
- Do not use "withBody" function when sending messages to Android, use "withRawContent" instead with a json object as showed in the java example below:
JSONObject gcmMessage = new JSONObject();
try {
JSONObject data = new JSONObject();
data.put("title", title);
data.put("body", message);
gcmMessage.put("data", data);
} catch(JSONException e){
LOGGER.error(e);
}
DirectMessageConfiguration directMessageConfiguration = new DirectMessageConfiguration()
.withAPNSMessage(new APNSMessage().withTitle(title).withBody(message).withSound("default"))
.withGCMMessage(new GCMMessage()
.withRawContent(gcmMessage.toString())
.withSound("default"));
Hope it helps !
Well hooray! That worked very nicely. Thanks so much!
I'm a bit distressed that this only buys us a year before GCM is phased out and FCM is the defacto push notification API, but I'll take it for now.
Thanks again for the magic spell.