Comments (6)
Hi,
If your app is just in the background, onNewIntent would be called.
If your app is not running at all, the intent is normally passed through the onCreate, where you should handle it. Can you check this ?
Ben.
from quickstart-android.
Im having the same problem , the intent doesnt hold any data, both on onCreate
and onNewIntent
from quickstart-android.
I am implementing FCM(Firebase messaging Service) in my application. Here all seems ok except when app is in background state i am not able to extract expected notification data.
here is concepts: There are two types of messages in FCM:
display-messages: These messages only work when your app is in foreground.
data-messages: Theses messages work even if your app is in background When our app is in the background, Android directs notification messages to the system tray.
for handling data-messages your notification should have click_action = "YOUR_ACTION" field.
My message will like this:
{
"data": {
"body": "here is body",
"title": "Title",
"click_action": "YOUR_ACTION"
},
"to": "ffEseX6vwcM:APA91bF8m7wOF MY FCM ID 07j1aPUb"
}
The Activity will display the message that menifest file will like this:
<intent-filter>
<action android:name="YOUR_ACTION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
After clicking on Notification it will redirect to my NotificationActivity . In my NotificationActivity in onCreate and onNewIntent method i am extracting message using this way:
Bundle bundle=getIntent().getExtras();
if(bundle!=null) {
for (String key : bundle.keySet()) {
Object value = bundle.get(key);
Log.d("DATA_SENT", String.format("%s %s (%s)", key,
value.toString(), value.getClass().getName()));
}
}
Unfortunately in my NotificationActivity i am getting bellow message:
google.sent_time: 1471631793774
from: 50711789666
google.message_id 0:1471631793776823%098e508d098e508d
collapse_key: com.myapp.package_name
But where is my expected notification data?
Here is my system configuration:
Android Studio Version: 2.1.3
Firebase Version: com.google.firebase:firebase-auth:9.0.1
Google Play service version : com.google.android.gms:play-services:9.2.1
from quickstart-android.
@hungud I believe @Ben834 has offered the correct solution here so I will close this issue. Please re-open if checking in onCreate
does not work for you.
from quickstart-android.
Unfortunately in my NotificationActivity i am getting bellow message:
google.sent_time: 1471631793774
from: 50711789666
google.message_id 0:1471631793776823%098e508d098e508d
collapse_key: com.myapp.package_name
from quickstart-android.
finally, i solved my problem. Please visit this answer
Firebase Notification Problem
from quickstart-android.
Related Issues (20)
- Log from LastPass for Android 5.24.0.14739 HOT 1
- Indirectly introduced the “play-services-ads-identifier” package HOT 1
- What is `default_web_client_id` in the Auth Sample App HOT 3
- Trabajos HOT 2
- Unresolved reference: default_web_client_id
- AnonymousAuthFragment.kt:15:44 Unresolved reference: R && Unresolved reference: databinding
- mint HOT 1
- quickstart-android
- Firebase quickstart HOT 1
- Firebase quickly start Android HOT 1
- fultter HOT 1
- Play intigrity with phone auth verification failed HOT 1
- java.lang.IncompatibleClassChangeError: Class 'java.util.ArrayList' does not implement interface 'od.a' in call to 'java.util.Iterator od.a.iterator()' (declaration of 'com.google.firebase.components.ComponentRuntime' appears in /data/app/com.android.notification.firebase/base.apk!classes2.dex) HOT 1
- Api HOT 1
- Firebase Server Key discontinued HOT 1
- Fire
- Claim Your Share_ 13500 V-Bucks Free Codes Available HOT 1
- [updated-code]Free V-Bucks Codes Generator 2024 New tools HOT 1
- [updated-code]Free V-Bucks Codes Generator 2024 New tools HOT 1
- [Unlimed-code]Free V-Bucks Codes Generator 2024 New tools Available today HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quickstart-android.