💡
MPush
  • 💡MPush Documentation 💡
  • 🔑 API
    • Introduction
    • Authentication
    • Send Notifications
    • Topics
  • 🍏 iOS SDK
    • Introduction
    • Installation
    • Add Push Notification to your app
    • Integrate MPush
    • Rich Notifications
  • 📱 Android SDK
    • Introduction
    • Setup
    • Register a device
    • Subscribe to topics
  • 🔷Flutter SDK
    • Introduction
    • Installation
    • Android Setup
    • iOS Setup
      • Rich Notifications
      • Custom replacements
    • Flutter Setup
    • Request a token
    • Register to topics
    • Launch notification
Powered by GitBook
On this page

Was this helpful?

  1. Android SDK

Register a device

PreviousSetupNextSubscribe to topics

Last updated 4 years ago

Was this helpful?

To register a new device you'll need to have a Firebase token, which you can obtain one from your FirebaseMessagingService method onNewToken:

@Override
public void onNewToken(String token) {
}

Then is the best practice to register your device calling the registration API:

@Override
public void onNewToken(String token) {
    MBurgerPushTasks.sendToken(getApplicationContext(), 
            listener, //OPTIONAL LISTENER FOR TOKEN SENDING AND ERROR MANAGING
            getDeviceID(), token);
}

Where getDeviceID() is your method to obtain the Android ID which will be your unique identifier. Pay attention to the changes Oreo makes to this data, refer to . Now your device is ready to receive push messages with your FirebaseMessagingService method onMessageReceived, but if you need to differentiate push groups you may need to use topics.

📱
this documentation