Push Notifications: Device registration fails using Kinvey


#1

Hello there, I am trying to set up Push Notifications on iOS, I have followed the guide in Kinvey documentation, also imported the .p12 development file in Kinvey servers and everything looks good, but when I try to register the device it goes to the error function where the message is empty, I am doing something like this:

Push.register({
      android: {
          senderID: '<Sender ID>'
      },
      ios: {
          alert: true,
          badge: true,
          sound: true
      }
})
.then((deviceToken: string) => {
    console.log(deviceToken);
})
.catch((error: Error) => {
    console.log(error.message);
});   

I have added the lines:

<key>aps-environment</key>
<string>development</string>

In the [AppName].entitlements file.

Is there something I am missing???

Thanks!


#2

Have you installed the nativescript-push-notifications plugin which is used internally by Kinvey?


#3

Hey @manojdcoder thanks for the reply. YES, I am using the nativescript-push-notifications plugin, also I see the message to Allow the app use push notifications on the device. But according to the code, it triggers the error function which does not give me any message.

09


#4

Did you try directly accessing push notification plugin and make your own register call, just to see if you are able to get the token then may be able to judge whether it’s a real Kinvey problem or not.


#5

Thats what I will do next, I will let you know…


#6

Using pushPlugin it does not register, this is the current code I am using:

pushPlugin.register({
    badge: true,
    sound: true,
    alert: true,
    clearBadge: true,
    interactiveSettings: {
        actions: [],
        categories: []
    },
    notificationCallbackIOS: (message: any) => {
        console.log(message);
    }
}, 
(token: String) => {
    console.log("Device registered: " + token);
}, 
(errorMessage: any) => {
    console.log("Device NOT registered! " + JSON.stringify(errorMessage));
});

#7

The other possible case you may face this issue if you haven’t enabled push services on your app id from developer portal. I hope you have might done that while creating your certificates, but may be worth double check.


#8

The provisional profile has push notifications enabled, the certificate I am using to build the dev app is a development certificate and the one who is in kinvey servers (as a .p12) is a push services for development. Am I missing something?

Thanks!


#9

May I know which device and OS version you are using to test this?


#10

Hi @manojdcoder, I am using an iPhone 8 and the MacOS simulators. I am starting to think that I need to pay to get Kinvey Push Notifications working, the FREE account does not have Push included.

Can you confirm this?


#11

I’m just little confused when you mentioned Simulators. Push notifications would work only on devices, are you using iPhone 8 device?

To answer your question, you must be able to get your push token as it is generated by Apple not Kinvey.


#12

I am using an iPhone 8 device, but I need Kinvey backend services to be able to send Notifications to certain users for ex, Administrators, Operators, Regular Users, or users by device, or by OS version, for ex: only users using iPhone X. I was able to do that in Telerik Backend Services using Push Notifications on Cordova.

I can use the plugin, which is still failing, but then I have to spend time on writing a backend service to restrict the message to certain users. I believe Kinvey has that covered, isnt it?

Thanks!


#13

Yes, I believe Kinvey has covered that.

But based on what you described, I don’t think the issue is with Kinvey, it must be something with your setup.


#14

I just removed the iOS platform and added it back and its registering the device using the plugin, I am testing using Kinvey right now… lets see!


#15

I just checked with Kinvey and it did not registered, but with the plugin I am able to register, seems like I need a payed subscription to be able to use Push on Kinvey. Too sad :frowning: