I didn't receive push notification on iPhone using cordova plugin - xcode

I integrated cordova plugin phonegap-plugin-push "PushPlugin" in my app, but after I send a notification, I didn't receive it with alert or badge or sound, nothing.
The registration has been successfully because gave the token correctly.
I also generated the push certificate (Apple Development IOS Push Services) and exported it in p12 format.
On Xcode I setted push notification button.
Someone can help me?
Thank you in advance.

There are 2 cases for your error.
When you call Push.Init, there is sth missing. Folling example is my own.
Push.init({
ios: {
senderID: "XXXXXXXXXX",
gcmSandbox: true,
alert: true,
badge: true,
sound: true
}
}
In https://developers.google.com/mobile/add, you have to add the platform ios and sign up your .p12 certificate in ios project of google console.

Related

Firebase push notification not shows when the app at foreground in android platform

I am developing both android and iOS application using the nativescript-angular framework. I am using a nativescript-plugin-firebase plugin for the fcm push notification. In the iOS platform, the notification is coming both in the foreground as well as in the background. But in android, the notification is coming only when the app is in the background.
How do we fix this issue?
My firebase initialization code:
firebase.init({
showNotifications:true,
showNotificationsWhenInForeground:true,
onPushTokenReceivedCallback:(token)=>{
console.log("onPushTokenReceivedCallback:",{token});
},
onMessageReceivedCallback:(message:firebase.Message)=>{
console.log("onMessageReceivedCallback:",{message});
})
.then(()=>{
console.log("Initialized");
})
.catch(error=>{
console.log("Initialize",{ error });
});
I'm struggling with Notifications too right now,
you can use Nativescript-Local-Notification plugin alongside with firebase plugin like me, you can have much more customized notifications and can handle them much better in client-side.
just schedule a local notification when you get your firebase callback.
it perfectly works in the foreground, I'm struggling to make it work in the background, in the background I just keep getting Firebase notification, can't disable it.

add the push notification feature to your App ID

I am creating an application with ionic. I already have the certificates downloaded and I wanted to receive the notifications using the xcode simulator, but I do not receive them. In the 'Capabilities' section, in the 'push notification' section I have the error:
'add the push notification feature to your App ID'
==================================================
Do not use xcode very well. I hope someone can help me.
a greeting
'add the push notification feature to your App ID'
As it states, go to developer apple portal to add the push notification feature to your App ID and regenerate your provisioning profile.
https://developer.apple.com/account/ios/identifier/bundle
You also have to generate a APNs Auth Key to make push notification and some coding is needed in your app. You can reference the following tutorial.
https://www.raywenderlich.com/156966/push-notifications-tutorial-getting-started

Sinch APN shouldSendPushNotifications never called

I can´t make Apple Push Notifications work in development mode. The shouldSendPushNotifications method is never called on the source device when the target device is in background mode. I have uploaded my APN development certificate in the Sinch Dashboard and instant messaging works if both devices are in foreground mode. I have a valid device token which I´m using for my own Push Messages. Here is my code:
sinCli = Sinch.clientWithApplicationKey("XXXX", applicationSecret: "XXXX", environmentHost: "sandbox.sinch.com", userId: sinchUserId)
sinCli.delegate = self
sinCli.setSupportMessaging(true)
if let deviceToken = defaults.dataForKey(Globals.KEY_APN_DEVICE_TOKEN)
{
sinCli.setSupportPushNotifications(true)
sinCli.registerPushNotificationDeviceToken(deviceToken, type: SINPushTypeRemote, apsEnvironment: SINAPSEnvironment.Development)
sinCli.setPushNotificationDisplayName("MyApp")
}
sinCli.start()
sinCli.startListeningOnActiveConnection()
sinCli.messageClient().delegate = self
did I forget something?
I think I need to see your swift wrapper, but it almost looks like you are setting up the client for push (not managed), and then registring the token for managed push.
When using managed push (when you upload to cert to us) shouldSendPush is never called, because Sinch takes care of the pushing, you should just get a push. What you do need is to have a push delegate https://www.sinch.com/tutorials/ios-managed-push/

Apple push notification issue for status true

I am sending apple push notification from java. I am getting true for pushedNotification.isSuccessful(). But push is not getting on ios device for that device token.
What can be the issue?
Finally resolved.
I found issue in p12 certificate. given device tokens were not registered to p12 I am using.

Coding Issue while registerForRemoteNotificationTypes

I had a support for push notification "registerForRemoteNotificationTypes" in my app which is under a macro "EnablePushNotification". That means only if I enable this macro, then my "registerForRemoteNotificationTypes" will be executed.
I have recently submitted my app to Apple Appstores, and they have sent me a warning as below:
"Missing Push Notification Entitlement - Your app appears to register with the Apple Push Notification service, but the app signature's entitlements do not include the "aps-environment" entitlement. If your app uses the Apple Push Notification service, make sure your App ID is enabled for Push Notification in the Provisioning Portal, and resubmit after signing your app with a Distribution provisioning profile that includes the "aps-environment" entitlement.
If you would like to update your binary for this app, you can reject this binary from the Binary Details page in iTunes Connect. Note that rejecting your binary will remove your app from the review queue and the review process will start over from the beginning when you resubmit your binary."
My question is that I had not enabled this macro "EnablePushNotification" so "registerForRemoteNotificationTypes" will never get executed. Also I had not enabled my appstores provisioning profile for push notification. Even then i got this warning. What might be the issue here? Help appreciated.
I think you should also put under macro following UIApplicationDelegate methods
application:didReceiveRemoteNotification:
application:didRegisterForRemoteNotificationsWithDeviceToken:
application:didFailToRegisterForRemoteNotificationsWithError:

Resources