<!-- < Only if you're using GCM or localNotificationSchedule() > --> <uses-permissionandroid:name="android.permission.WAKE_LOCK" /> <permission android:name="${applicationId}.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-permissionandroid:name="${applicationId}.permission.C2D_MESSAGE" /> <!-- < Only if you're using GCM or localNotificationSchedule() > -->
<application....> <meta-dataandroid:name="com.dieam.reactnativepushnotification.notification_channel_name" android:value="YOUR NOTIFICATION CHANNEL NAME"/> <meta-dataandroid:name="com.dieam.reactnativepushnotification.notification_channel_description" android:value="YOUR NOTIFICATION CHANNEL DESCRIPTION"/> <!-- Change the resource name to your App's accent color - or any other color you want --> <meta-dataandroid:name="com.dieam.reactnativepushnotification.notification_color" android:resource="@android:color/white"/>
<!-- < Only if you're using GCM or localNotificationSchedule() > --> <receiver android:name="com.google.android.gms.gcm.GcmReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND" > <intent-filter> <actionandroid:name="com.google.android.c2dm.intent.RECEIVE" /> <categoryandroid:name="${applicationId}" /> </intent-filter> </receiver> <!-- < Only if you're using GCM or localNotificationSchedule() > -->
<!-- < Only if you're using GCM or localNotificationSchedule() > --> <service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerServiceGcm" android:exported="false" > <intent-filter> <actionandroid:name="com.google.android.c2dm.intent.RECEIVE" /> </intent-filter> </service> <!-- </ Only if you're using GCM or localNotificationSchedule() > -->
// (optional) Called when Token is generated (iOS and Android) onRegister: function(token) { console.log( 'TOKEN:', token ); },
// (required) Called when a remote or local notification is opened or received onNotification: function(notification) { console.log( 'NOTIFICATION:', notification );
// process the notification
// required on iOS only (see fetchCompletionHandler docs: https://facebook.github.io/react-native/docs/pushnotificationios.html) notification.finish(PushNotificationIOS.FetchResult.NoData); },
// ANDROID ONLY: GCM or FCM Sender ID (product_number) (optional - not required for local notifications, but is need to receive remote push notifications) senderID: "YOUR GCM (OR FCM) SENDER ID",
// IOS ONLY (optional): default: all - Permissions to register. permissions: { alert: true, badge: true, sound: true },
// Should the initial notification be popped automatically // default: true popInitialNotification: true,
/** * (optional) default: true * - Specified if permissions (ios) and token (android and ios) will requested or not, * - if not, you must call PushNotificationsHandler.requestPermissions() later */ requestPermissions: true, });