infobip / mobile-messaging-react-native-plugin

Mobile Messaging SDK plugin for React Native projects
26 stars 5 forks source link

Push notifications is not working in React Native #2

Closed pratius closed 4 years ago

pratius commented 4 years ago

Hi,

Thank you for RN Plugin.

I have implemented the below code to insert user information on the Infobip portal. But always inserting unexpected information on Portal and Push notification is not working.

Requirement We want to register an email address on the portal. Because as per our requirements sending to push notification on phone, we are using user email Id and push ID. But in React Native case ID parameter is always inserting default random ID.

Maybe because of that, failing the Notification in React Native.

Note:-I have done the same implementation in native iOS it's inserting expected information on Portal and working notification also for the phone.

I have attached both images for references.

Implementation:-

Calling for initialization:- import { mobileMessaging } from "infobip-mobile-messaging-react-native-plugin"; mobileMessaging.init( {```

applicationCode:
  "here infobip application code",
ios: {
  notificationTypes: ["alert", "badge", "sound"]
}

}, () => { console.log('MobileMessaging started'); }, error => { console.log('MobileMessaging error: ', error); }, );

mobileMessaging.register('registrationUpdated', message => { console.log('Event received', message);

});

User information Register to Infobip Portal:-

const user = { externalUserId: "testadmin@gmail.com", firstName: "PP", lastName: "Dubey", phones: ["9710000000"], emails: ["testadmin@gmail.com"], }; );

mobileMessaging.saveUser( user, user => { console.log("Inserted data on Success", user); }, user => { console.log("Inserted data error", user); } ); Please help us with this scenario and let's know if we are missing any implementation for the same.

Thanks, Pratius

iOS-Native-Portal-ScreenShot React-Native-Portal-Screen-Shots
tjuric commented 4 years ago

Hi @pratius, it doesn’t sound like a technical question related just to this plugin, but business question about functioning of our services.

You should contact our support on support@infobip.com. If they verify that all is fine with business setup, we can come back to this thread.

BR, Tereza

riskpp commented 4 years ago

Hi @pratius, We've released new plugin version with fix of saving emails and phones using saveUser method. But note that for the saving phone and email we have more suitable method personalize, docs you can find here: https://github.com/infobip/mobile-messaging-react-native-plugin/wiki/Users-and-installations#personalization-phone-numbers-emails-and-external-user-id

Feel free to contact our support at support@infobip.com if you need any recommendations on the implementation.

pratius commented 4 years ago

Hi @tjuric ,

Thank you for the response.

I have updated the NPM and Pods files, SDK initialization is working fine. But while saving/personalize user information, we are getting the below exceptions.

                                             **Implimention for push notification** 

Initilizating on didFinishLaunchingWithOptions: [MobileMessagingPluginApplicationDelegate install];

Calling for initialization:

i mport { mobileMessaging } from "infobip-mobile-messaging-react-native-plugin"; mobileMessaging.init( {

applicationCode: "here infobip application code", ios: { notificationTypes: ["alert", "badge", "sound"] } }, () => { console.log('MobileMessaging started'); }, error => { console.log('MobileMessaging error: ', error); }, );

mobileMessaging.register('registrationUpdated', message => { console.log('Event received', message);

});

 **SaveUser  Integration**

const user = { firstName: "PKD", lastName: "Doe", phones: ["79210000000"], emails: ["bkperson1@gmail.com"] };

mobileMessaging.saveUser( user, user => { console.log("Inserted data onSuccess", user); }, user => { console.log("Inserted data error", user); } );

**SaveUser Exception:**

{
 code: 1,
  description: 'The application instance is not registered on the server yet. The registration will be perfomed eventually. Subscribe to the notification `MMRegistrationUpdated` to be notified as the registration succeeded.',
}

And also I have tried the personalize method getting exception.

**Personalize Integration:**

const context = { phones: ["971-508637145"], emails: ["bkperson1@gmail.com"], externalUserId: "bkperson1@gmail.com" };

mobileMessaging.personalize(
  context,
  userIdentity => {
    console.log("personalize data onSuccess", userIdentity);
  },
  userIdentity => {
    console.log("personalize data error", userIdentity);
  }
);

`Personalize Exception`

{
 domain: 'com.mobile-messaging-react-native-plugin',
  description: 'Could not retrieve required arguments.',
  code: 0
}

Could you please let's know where we are missing the integration? 

Thanks,
Pratius Dubey
riskpp commented 4 years ago

Hi @pratius, Could you please check what is mentioned here: https://github.com/infobip/mobile-messaging-sdk-ios/wiki/I-don't-receive-push-notifications

BR, Olga

pratius commented 4 years ago

Hi @riskpp,

Thank you for quick support. Notification is working fine, But somehow not getting notification while App in foreground iOS.

Thanks, Praitus Dubey

riskpp commented 4 years ago

Hi @pratius, What do you mean "not getting notification while App in foreground iOS"?
You didn't received "messageReceived" event (https://github.com/infobip/mobile-messaging-react-native-plugin/wiki/Events) ? Note, that you will not see notification alert, while app is in the foreground, if you didn't implemented it on received "messageReceived" event. However, you could send In-App notification (https://github.com/infobip/mobile-messaging-react-native-plugin/wiki/In-app-notifications).

Probably will be better to contact our support at support@infobip.com if you need further recommendations on the implementation.

BR, Olga

pratius commented 4 years ago

Hi @riskpp ,

Thanks, this is very useful.

Now We are facing the intermittent issues below.

**> { description: 'The application instance is not registered on the server yet. The registration will be perfomed eventually. Subscribe to the notification MMRegistrationUpdated to be notified as the registration succeeded.',

code: 1, domain: 'com.mobile-messaging' }**

Can you please help us?

Thanks, Pratius

riskpp commented 4 years ago

Assisting with integration continued by emails from support@infobip.com.