Class Veery

setFirebaseToken(String token)

Let Veery know what is the FCM token of the device.

This should be called any time after FirebaseApp.initializeApp is called (Usually on the onCreate callback of the main activity).

It should also be called from the FirebaseInstanceIdService.onTokenRefresh() to let Veery know the token has changed

This function scopes the agent, so it is not necessary to call it from all Activities.

Parameters

Param name Type Usage
token String Token received from the FirebaseInstanceId.getInstance().getToken() static function

Returns

void

Usage / Example

On Activities :

 public class MapsActivity extends AppCompatActivity {

    private final Veery veery = new Veery(this);

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        veery.serviceConnect();
        veery.setApiKeySecret("SuPeRScrET12345789GhJ");

        // TODO : initialize firebase
        FirebaseApp.initializeApp(this);
        // TODO Let veery know the Firebase token
        veery.setFirebaseToken(FirebaseInstanceId.getInstance().getToken());

        // ...Some initialization here...
    }
    // ...
 }

On FirebaseInstanceIdService :

  // 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() {

         // TODO : Let Veery know the Device Token
         veery.setFirebaseToken(FirebaseInstanceId.getInstance().getToken());

     }
 }

User interaction

none