Skip to content

Google FCM getIntent returns null when app is not running or when app is in background #96

@thomasdsouza

Description

@thomasdsouza
  • Android device: Nexus 5 or emulator
  • Android OS version: Android N or Android M
  • Google Play Services version: 9.2.1
  • Firebase/Play Services SDK version: 9.2.1

Steps to reproduce:

  1. Using the Firebase console (or via the REST API), send a notification with custom data (for e.g. key "discount" value "10" )
  2. app is in background or not running

Observed Results:

though, the notification does appear in the system tray, the data is NOT available in the intent... either in onNewIntent or in onCreate, the extras is null.

Expected Results:

According to the Firebase Notifications docs, when App State is Background and a Notification with data is sent, the notification appears in the system try and the data will be available in the extras of the intent.

@OverRide
public void onCreatet() {
Bundle extras = getintent().getExtras();
---> extras is always null when app is not running or when app is in background
}

@Override
public void onNewIntent(Intent intent) {
    Bundle extras = intent.getExtras();
    ---> extras is always null when app is not running or when app is in background
}

Remarks: The data is available when App State is in the Foreground. But the notification console is pretty much unusable with this bug because ALL (background, app not running, foreground) users need to be able to get the data in a notification. Otherwise, how does a developer know what data a user saw or didn't see (e.g. whether a user was shown the discount 10% or not).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions