Module Veery

setVeeryToken(String)

Let Veery known what is the APNs, FCM token of the device.

This should be called from firebase.messaging().getToken().then((token) => {......}); for android(FCM) part and from AppDelegate.m for IOS(APNs) part.

Parameters

Param name Type Usage
token String Device token received from the APNs, FCM

Returns

Void

Usage

Android

Using the native Firebase Cloud Messaging

_

 // TODO : Import the Veery Library
 import com.roofstreet.android.veery.Veery;

 public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService {

 // TODO : Declare a persistant Veery Object
 Veery veery = new Veery(this);

 @Override
         public void onTokenRefresh() {

             try {
                     Looper.prepare();
             }catch (RuntimeException e){
                     Log.e("MyFirebase", "onTokenRefresh : RuntimeException " + e.toString());
             }
     // TODO : Let Veery know the Device Token
                 veery.setFirebaseToken(FirebaseInstanceId.getInstance().getToken());

         }
 }

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().getToken().then((token) => {

    console.log('Device FCM Token: ', token);
    Veery.setVeeryToken(token);
  });

    firebase.messaging().onTokenRefresh((token) => {
            console.log('Refreshed FCM token: ', token);
            Veery.setVeeryToken(token);
    });

IOS

// Required for the register event.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    // TODO Let veery know the device token
 [veery setAPNSTokenWithToken:deviceToken];
}

User interaction

none