Android Native library to use on React-Native android Android
1- Download the first verion pushbotsclientmodule.aar
2- Place it into the android/app/libs
3- put this code into module build.gradle:
dependencies { ... implementation files('libs/pushbotsclientmodule.aar') ... }
4- set your push bots appId in build.gradle:
`manifestPlaceholders = [push_bots_app_id: "5d258e58b7941208c73fcfb7"]`
5- open you AndroidManifest.xml file and past the below code inside application tag:
`<receiver android:name=".PushBotsBroadcastHandler" />
<service
android:name="com.farshidabz.pushbotsclientmodule.service.PushBotsFireBaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service
android:name="com.farshidabz.pushbotsclientmodule.service.InstanceIdService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<meta-data
android:name="com.farshidabz.pushbotsclientmodule.AppId"
android:value="${push_bots_app_id}" />`
1- in your PushBotsFCMModule.js:
` import {NativeEventEmitter, NativeModules} from 'react-native';
module.exports = NativeModules;`
2- in your app.js:
import below code to access to the native madule
`import PushBotsExample from './PushBotsFCMModule';`
#sample
`async function sendNotification() {
try {
var token = await PushBotsExample.PushBotsNativeModule.getFCMToken();
console.log('>>>>>> token is: ' + token);
} catch (e) {
console.error(e);
}
}`
https://github.com/FarshidABZ/PushBotsReactNativeApp