Ionic Push Notification: Not receiving in IOS - android

THE SITUATION:
I use Ionic Push Notifications in my app.
With android everything works fine. But with IOS I don't receive any notification.
The code should be fine. The registration of the token it works properly also inside IOS devices. I can see the token in the database.
Also the cURL request code should be fine since it is working for android.
I will paste below all the info that may be useful:
THE CODE:
Initialization:
$ionicCloudProvider.init({
"core":
{
"app_id": "MY_APP_ID"
},
"push":
{
"sender_id": "MY_SENDER_ID",
"pluginConfig": {
"ios": {
"badge": true,
"sound": true
}
}
}
});
io-config.json:
{"app_id":"MY_APP_ID","api_key":"MY_API_KEY","dev_push":false,"gcm_key":"MY_GCM_KEY"}
THE CERTIFICATES:
In ionic.io I have setup the certificate - production mode - and activate all the credentials:
Inside the Apple Developer Console, the Push Notifications service is properly enabled (for production)
THE TESTS:
The app is already published in the App store.
Anyway i made tests both locally through XCODE (with the devices connected to it) and directly downloading the app from the app store.
I never received any notifications.
Making a test using POSTMAN this is the outcome:
{
"data": {
"status": "open",
"uuid": "b55a9024-d0d9-480e-a813-02053bcf2f2a",
"created": "2016-09-19T14:05:01.097422+00:00",
"state": "enqueued",
"app_id": "MY_APP_ID",
"config": {
"tokens": [
"THE_RECEIVER_TOKEN"
],
"notification": {
"message": "Push test"
},
"profile": "MY_IONIC_IO_PROFILE"
}
},
"meta": {
"status": 201,
"request_id": "dbb57cba-3817-42ee-baaf-7175b5f6c755",
"version": "2.0.0-beta.0"
}
}
THE QUESTION:
Why I am not receiving any notification on IOS?
Am i missing something?
Thank you!

Make sure notifications are enabled in your iOS settings app
Try using content_available = true in push payload
Try using priority = "high" in push payload
Make sure you're not sending using development certificates on a production app version or viceversa
Make sure your token is valid and refreshed
Docs about priority and content_available attributes
From docs:
On iOS, set content_available when the app server needs to send a Send-to-Sync message. An inactive client app will execute your logic in the background, while an app in the foreground will pass the message to didReceiveRemoteNotification:.

Make sure you have latest version of Ionic i,e v2 and above.
In path src/app/app.components.ts
After platform.ready().then(() => { add the below code
var push = Push.init({
android: {
senderID: "XXXXXXXXX"
},
ios: {
alert: "true",
badge: true,
sound: 'false'
},
windows: {}
});
push.on('registration', (data) => {
console.log(data.registrationId);
alert(data.registrationId.toString());
});
push.on('notification', (data) => {
console.log(data);
});
After build (ionic build ios) open the ionic project in Xcode and in general and team section choose an account which has paid apple developer account.
Then in capabilities enable push notification.
If all the other constraints like certificate and .p12 files are done as per apple guild lines then push will surely work.
For more info visit this link : http://ionicframework.com/docs/v2/native/push/

Related

How should I send notifications with push notifications thru FCM for both Android and iOS?

I am trying to send notifications to both Android and iOS devices using FCM. The front end was coded with Flutter. I am working with Typescript/NestJS at the back end. For some reason, iOS devices receive all the notifications with a push notification/pop-up but Android devices sometimes don't. Strangely, the notifications ALL arrive at the test device INBOXES. It's just that sometimes, Android devices do not show a pop-up/push notification.
Targeting users thru a Firebase topic works as expected: push notifications do arrive for Android and iOS. I do have to find and filter out the users to target before sending the target device IDs to FCM. I am confident my filters are correct. The notifications arrive in the app inbox for both Android and iOS after my filtering. Also, changing the device ID/token in my database causes an error from FCM:
{"code":"messaging/registration-token-not-registered","message":"Requested entity was not found."}
If I revert the data to its original values, the app runs fine. I've checked and compared the data I pass to Node.js' FCM module and it looks fine. Here, messaging is an instance of firebaseAdmin.messaging().
param = {
"android": {
"data": {
"id": "67bcd478-f643-4c9e-848a-be354a6b85d4",
"icon": "default",
"title": "Test",
"body": "Direct From Playground"
}
},
"apns": {
"payload": {
"aps": {
"id": "67bcd478-f643-4c9e-848a-be354a6b85d4",
"icon": "default",
"title": "Announcements",
"body": "Direct From Playground",
"alert": {
"title": "Announcements",
"body": "Direct From Playground"
}
}
}
}
}
messaging.sendMulticast({
tokens: value as string[],
...param,
});
Again, the code above sometimes successfully triggers push/pop-up notifications on Android devices but ALWAYS on iOS. Could this be a problem for the front-end handling of my data? Am I missing some parameters?

Flutter Huawei push by http

im trying to send push by http to Huawei Devices with Huawei consolé integration, but the documentation is confuse, and i'm not really sure how to build my body to send
I have this, but only works for foreground, if the app is in background or terminated, the push isn't working
This is the portar i'm following https://developer.huawei.com/consumer/es/doc/development/quickApp-Guides/quickapp-access-push-kit#dataDesc
{
"validate_only": false,
"message": {
"data": "{title: Hello! 1, description: Hello, shirley!, params: { key1: test1, key2: test2}, ringtone: {vibration: true, breathLight: true}}",
"android": {
"title": "Hello! 1",
"body": "Hello, shirley!",
"params": {
"key1": "test1",
"key2": "test2"
},
"click_action": {
"type": 3
}
},
"token": [
"IAAAAACy0irbAADqfnlY9pfEgoWWoIzgCBXQzPol8CTNzV6i3V5byP7cIhuU74vovAwysjkI_XMwowYj1sv5SrhXRi-sYXB5OrplLHEB02LO0pKHcA"
]
}
}
The conditions received by the Push notification do not need to be run in the foreground.
According to the Docs,You can send push messages in either of the following ways:
Select target users in AppGallery Connect. In this case, messages can be pushed to both quick apps on the live network and those running on a quick app loader.
Send push messages to a large number of users in batches by invoking server APIs. In this case, messages can be pushed to both quick apps on the live network and those running on a quick app loader.
Conditions for a quick app to receive push messages are as follows.

React Native Android remote push notifications not showing up

I am using the react-native-push-notification package and PubNub push notifications to handle the remote notifications. This all works on iOS just fine and I'm getting the notification data coming in from the onNotification method on android but there is no actual notification popping up on the screen as I would expect. Am I missing a configuration on the FCM side maybe or a specific permission check I need to ask for to make sure remote notifications can be shown on android devices?
I've followed the manual steps on the react-native-push-notification package to a T and triple checked I didn't miss something
This GCM bit I was passing to Pubnub was this
"pn_gcm": {
"data": {
"title_for_mobile": "George Washingtons's phone has moved outside of the group",
"summary_for_mobile": [ "George Washingtons's phone has moved outside of the group" ],
"data": {
"action": "radiusTrigger",
"userId": 6,
"groupId": 8
}
}
}
and the title_for_mobile wasn't sending it to my phone as a push notification so I had to change it to
"pn_gcm": {
"data": {
"message": "George Washingtons's phone has moved outside of the group",
"data": {
"action": "radiusTrigger",
"userId": 6,
"groupId": 8
}
}
}
And now it shows the notification on android

Ionic push notification doesn't open app and is single line

I'm building an Ionic app, installed the phonegap push plugin and set up the ionic io push settings with a real google developer api key. I didn't set any certificates or other keys for android in the ionic framework. For IOS I didn't set anything, as the app is still in development and there isn't a Apple Developer Account yet.
Now I was very happy, as I could receive push notifications. Now I found 2 problems with the notification:
1: It's single line, so the text would be "Hey this notification is too lo...". How can I make sure this is multi line?
2: When I press the notification, it doesn't open the app. Is this because it's a debug apk?
Here is the push data I send using the ionic push api:
tokens": tokens,
"profile": profile,
"notification": {
"title": title,
"message": message,
"android": {
"icon": "ic_stat_icon",
"icon_color": "#99004C"
},
"ios": {
"badge": "1"
}
}
After contacting the dev team of phonegap and ionic, we managed to find the solution. It turns out that there is a bug in the Ionic push framework OR the phonegap push plugin. Which one it is I'm not sure about.
It turns out that setting the android 'icon' in the data that you push to the Ionic push framework breaks the notification. This causes the notification to not be expendable, so only single line, not opening the app when you tap the notification, no sound etc.
The solution to this is setting the icon in the init of the phonegap plugin like so:
.run(function ($ionicPlatform, $http) {
$ionicPlatform.ready(function () {
var push = new Ionic.Push({
"debug": true,
"pluginConfig": {
"android": {
"icon": "ic_stat_icon"
}
}
});
push.register(function(token) {
console.log("Device token: " + token.token);
})
});
})

Cannot receive push notifications in Android with trigger.io and parse.com

I have just started developing an app for Android and iPhone with trigger.io and parse.com. Now I'm stuck trying to add push notifications to the app. I send test pushes from the control panel at parse.com but nothing happens on the Android phone I'm testing with.
Here's what I've done:
Added the partners/parse section in config.json with applicationId and clientKey from the settings at parse.com
Added "event": true to the modules section in config.json
My config.json looks like this:
{
"config_version": "2",
"name": "My test app",
"author": "(my email)",
"version": "0.1",
"platform_version": "v1.4",
"description": "An empty app created by default",
"modules": {
"logging": {
"level": "DEBUG"
},
"event": true,
"geolocation": true,
"contact": true,
"file": true,
"is": true,
"media": true,
"notification": true,
"prefs": true,
"request": {
"permissions": ["http://*/*", "https://*/*"]
},
"tools": true,
"reload": true
},
"partners": {
"parse": {
"applicationId": "(my real app id)",
"clientKey": "(my real client key)"
}
}
}
Added the following code to listen for incoming pushes:
forge.logging.info('Adding push listener');
forge.event.messagePushed.addListener(function (msg) {
forge.logging.info('Got push: ');
forge.logging.info(JSON.stringify(msg));
}, function(err) {
forge.logging.error('There was an error receiving push!');
forge.logging.error(err);
});
To test the app I connect my Android phone by USB cable to my Mac and choose "Run android" in Trigger toolkit in the browser
In the log I see the messages "Initializing Parse and subscribing to default channel" and "Adding push listener"
I go to parse.com Push notifications and see that there is one connected device. I test to send several messages, some in "Message" mode, some in JSON mode.
Parse thinks that the messages get sent but nothing is logged on my side
I also tested connecting another Android phone. Parse then indicated that there were two reachable phones, but the new phone didn't get any messages either.
Looking at the documentation and examples I can't think of anything else to try. I cannot decide if this is a trigger.io problem or a parse.com problem.
Does anyone have any ideas?
Is this a problem just when you're using the default broadcast - rather than a named - channel?
We have a fix for a problem with the broadcast channel on Android ready to be deployed tomorrow or early next week - it will be in platform version v1.4.27.

Categories

Resources