Upgrade to Pro — share decks privately, control downloads, hide ads and more …

FCM - something new and something interesting

FCM - something new and something interesting

Sergii Bosovskyi, Android developer

GDG Cherkasy

February 24, 2017
Tweet

More Decks by GDG Cherkasy

Other Decks in Programming

Transcript

  1. GCM to FCM migration 1. In the Firebase console, select

    Import Google Project 2. Switch to FCM in the app-level build.gradle compile "com.google.firebase:firebase-messaging:9.0.0" 3. Remove permissions and receiver from Manifest 4. Remove registration FirebaseInstanceId.getInstance().getToken(); If we need this. 5. Update and Migrate Listener Services
  2. Changes for topics Asynchronous execution: the method doesn't block the

    current thread; instead, the operation is automatically performed in a background thread. You won't the need to manage threads as you did for GCM. Auto retry logic: the operation is stored and automatically retried in case of connectivity issues. Implicit token: the previously required token is now automatically created, using the sender ID specified by the Firebase Project.
  3. Notification messages Params: title, body, icon, tag, color, click_action, body_loc_key,

    body_args_key, title_loc_key, title_loc_args Notification messages are delivered to the notification tray when the app is in the background. For apps in the foreground, messages are handled by callback: onMessageReceived()
  4. Both types in message if (getIntent().getExtras() != null) { for

    (String key : getIntent().getExtras().keySet()) { String value = getIntent().getExtras().getString(key); if (key.equals("AnotherActivity") && value.equals("True")) { Intent intent = new Intent(this, AnotherActivity.class); intent.putExtra("value", value); startActivity(intent); finish(); } } }
  5. Collapsible and non-collapsible non-collapsible . Each message will be delivered.

    Default for data messages. collapsible . replace if it has yet to be delivered to the device
  6. Strategies how to use Do we need push tokens on

    our server? Or can we just to use topics?