pushy / pushy-react-native

The official Pushy SDK for React Native apps.
Apache License 2.0
16 stars 20 forks source link

Missing documentation: setting AppId #64

Closed hidde-jan closed 3 years ago

hidde-jan commented 3 years ago

Currently, there is no (documented) way to set the AppId in this react native library. Both the android and ios SDK have a way to set the app id that pushy uses.

pushy commented 3 years ago

Hi @hidde-jan, Thanks so much for reporting this issue.

We've just released version 1.0.18 of the Pushy RN SDK, and version 1.0.17 of the Pushy RN Android SDK which add support for Pushy.setAppId().

Run the following command in the root directory of your project to update to the latest pushy-react-native package from npm and relink the iOS module:

npx react-native unlink pushy-react-native
npm install pushy-react-native@1.0.18 --save
npx react-native link pushy-react-native

Import version 1.0.70 of the Pushy Android SDK and version 1.0.17 of our React Native SDK by adding the following dependencies to your android/app/build.gradle, within the dependencies {} declaration:

// Pushy SDK for Android
implementation 'me.pushy:sdk:1.0.70'

// Pushy SDK for React Native Android
implementation 'me.pushy:sdk-react-native:1.0.17'

Finally, call Pushy.setAppId() in App.js before Pushy.listen():

Pushy.setAppid('your-app-id');

To revert to the default behavior of package name / bundle ID identification, simply pass in null to the method.