infobip / mobile-messaging-react-native-plugin

Mobile Messaging SDK plugin for React Native projects
24 stars 4 forks source link

Cannot connect SDK to infobip server even though following all instructions #32

Closed dameunbite closed 2 years ago

dameunbite commented 2 years ago

I have installed the sdk properly but cannot figure out how to connect it to infobip servers. I have been with this error for the past 2 weeks. What can I do to fix this issue?

This is the error message:

{code: 1, domain: 'com.mobile-messaging', description: 'The application instance is not registered on the …ed to be notified as the registration succeeded.'} code: 1 description: "The application instance is not registered on the server yet. The registration will be perfomed eventually. Subscribe to the notificationMMRegistrationUpdatedto be notified as the registration succeeded." domain: "com.mobile-messaging"}

Below is the code that is throwing the error.

mobileMessaging.saveUser({ externalUserId: 'randomid', emails: ['sampleemail@gmail.com'], phones: ['787XXXXXXX'] }, user => { // Here you can use updated user instance console.log("saved user"); }, (err) => { console.log(err); });

Here are the images of the code and the aplication in the portal.

Screen Shot 2021-12-06 at 4 57 45 PM

Screen Shot 2021-12-06 at 4 57 04 PM

riskpp commented 2 years ago

Hi @dameunbite,

This error means that, registration wasn't performed yet and you need to receive "registrationUpdated" event, to be able to perform any other calls like "mobileMessaging.saveUser".

  1. Don't you testing it on iOS Simulator just in case? On simulator we can't get APNS token, so it's not possible to register and test features.
  2. You can check Example application, just in case you missed some integration part.
  3. Recheck that you don't miss something from Quick start guide.

BR, Olga

dameunbite commented 2 years ago

I have followed all the react-native integration and I keep getting the same error in production. This are the events logged from real device.

mobileMessaging.init runs successfully and it does not give any error but on mobileMessaging.saveUser it gives the error displayed before (mobileMessaging.saveUser happens very quick after init). Is there another way we can troubleshoot this? Also can this error be more specific?

Should I listen to registrationUpdated first and then do mobileMessaging.saveUser after successfull registrationUpdated?

Screen Shot 2021-12-08 at 4 47 20 PM .

riskpp commented 2 years ago

Hi @dameunbite,

You can register to "registrationUpdated" event and make other calls after it happen. Just to notice "registrationUpdated" event is posted during the registration process, after a current APNs device token is stored on the server and the new Push Registration Id for the current user is generated. So it'll be posted once, if device token already provided to the server this event won't come, talking easily after application restart this event won't come.

What else could be done to troubleshoot some other problems:

  1. You could enable logging for iOS as in Example and provide logs
  2. You could register to all supported events as done here and put results to the console.log, just to check that registration went well.

BR, Olga

dameunbite commented 2 years ago

It's not working! I have added a log to our server to check what infobip package is responding. I get successful mobileMessaging.init callback but the app is not being reported in the server. Is even asking for the push notification and we are allowing it.

Can we set up a meeting?

Screen Shot 2021-12-16 at 4 17 18 PM

Screen Shot 2021-12-16 at 4 16 47 PM Screen Shot 2021-12-16 at 4 20 10 PM
riskpp commented 2 years ago

Hi @dameunbite, sorry for daly in answer.

Could you please send this question to support@infobip.com.

BR, Olga