Module Veery
VeeryNotificationHandler(notification,callback)
Transfers an APNs, FCM notification to Veery.
The APNs, FCM notifications that are supposed to be handled by Veery will have specific signature, so only messages for Veery will be handled by Veery.
This should be called from firebase.messaging().onMessage((message) => {.....});
for android(FCM) part and from AppDelegate.m
for IOS(APNs) part.
Parameters
Param name | Type | Usage |
---|---|---|
notification | none | Information related to the remote notification |
callback | callback | Waiting for the return |
Returns
Boolean
Value | Meaning |
---|---|
true | the message were handled by veery (Veery signature valid) |
false | the message were not handled by veery (Veery signature not valid). In that case the message comes from another framework or from your own APNs, FCM servers |
Usage
Using the native Firebase Cloud Messaging
_
// TODO : Import the Veery Library import com.roofstreet.android.veery.Veery; public class MyFirebaseMessagingService extends FirebaseMessagingService { String TAG = "MyFirebaseMessagingService"; // TODO : Declare a persistant Veery Object Veery veery = new Veery(this); @Override public void onMessageReceived(RemoteMessage remoteMessage) { try { Looper.prepare(); }catch (RuntimeException e){ Log.e("MyFirebaseMessaging", "onMessageReceived : RuntimeException " + e.toString()); } // TODO : if veery can handle the notification, just return if (veery.firebaseMessageHandler(remoteMessage)) return; // Veery did not recognize the notification so it comes from another framework // Your own Handle code here } // There is more code generated by android studio here (no change) }
Using react-native-firebase
_
import React, { Component } from 'react'; import Veery from 'react-native-veery'; import RNFirebase from 'react-native-firebase'; const configurationOptions = { debug: true }; const firebase = RNFirebase.initializeApp(configurationOptions); firebase.messaging().onMessage((message) => { Veery.VeeryNotificationHandler(message, (response) =>{ console.log('response',response); if (response !== true) { // Your own Handle code here } }) });
IOS
// Required for the notification event. You must call the completion handler after handling the remote notification. - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { if (![veery apnsMessageHandler:userInfo]){ // Veery did not recognize the notification so it comes from another framework // Your own Handle code here }; }
User interaction
none