FCM never delivers when app is in background - android

I have integrated FCM in my app. Whenever app is in background, no fcm message is received. I have tried both notification type and data type messages. Even notification messages are not displayed in notification tray. They are just lost!
Please help me out where I am going wrong. I have followed everything as per documentation and have been researching on this for a whole week.
My Manifest:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application ....>
<service
android:name=".MyFirebaseMessagingService"
android:exported="true"
android:enabled="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
</application>
My Firebase messaging service:
public class MyFirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG = "MyFirebaseMsgService";
SharedPreferences sharedPref;
#Override
public void onMessageReceived(RemoteMessage remoteMessage) {
if (remoteMessage.getData().size() > 0) {
Log.d(TAG, "Message data payload: " + remoteMessage.getData());
sendNotification(remoteMessage.getData().get("title"), remoteMessage.getData().get("message"));
}
if (remoteMessage.getNotification() != null) {
Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody());
sendNotification(remoteMessage.getNotification().getTitle(), remoteMessage.getNotification().getBody());
}
}
#Override
public void onNewToken(String token) {
sendRegistrationToServer(token);
}
private void sendRegistrationToServer(String token) {
//Sending handled here
}
/**
* Create and show a simple notification containing the received FCM message.
*
* #param messageBody FCM message body received.
*/
private void sendNotification(String title, String messageBody) {
Intent intent = new Intent(this, UserHomeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra("title", title);
intent.putExtra("message", messageBody);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 273, intent,
PendingIntent.FLAG_ONE_SHOT);
//String channelId = getString(R.string.default_notification_channel_id);
String channelId = "Sandeep123";
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this, channelId)
.setContentTitle(title)
.setSmallIcon(R.mipmap.ic_launcher_foreground_new)
.setColorized(true)
.setColor(Color.BLUE)
.setContentText(messageBody)
.setAutoCancel(true)
.setVisibility(VISIBILITY_PUBLIC)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent);
NotificationManager notificationManager =(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
//NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
// Since android Oreo notification channel is needed.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel(channelId,
getString(R.string.channel_name),
NotificationManager.IMPORTANCE_HIGH);
notificationManager.createNotificationChannel(channel);
}
notificationManager.notify(createID(), notificationBuilder.build());
}
public int createID() {
Date now = new Date();
int id = Integer.parseInt(new SimpleDateFormat("ddHHmmss", Locale.US).format(now));
return id;
}
}
I have added both my debug and release SHA-1 in firebase console. I dont know where else i can be going wrong. It works on all devices when app is active. But it does not work at all when app is in background.
*------------Update - server side code
function sendGcmNotification($amountAdded, $tok,$des){
define( 'API_ACCESS_KEY', '***' );
$title = "Rs.".$amountAdded." added as credit";
$notificationMsg = "***";
//$token = array();
//$token[] = $tok;
$msg =
[
'message' => $notificationMsg,
'title' => $title
];
$android = ["priority"=>"high"];
$fields =
[
'to' => $tok,
'data' => $msg,
'time_to_live' => 900,
'priority' => 10,
'android' => $android
];
$headers =
[
'Authorization: key=' . API_ACCESS_KEY,
'Content-Type: application/json'
];
$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send' );
curl_setopt( $ch,CURLOPT_POST, true );
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
$result = curl_exec($ch );
curl_close( $ch );
echo $result;
}
The Log cat Log is as follows:
2019-01-24 11:14:08.310 1541-1578/? W/ActivityManager: Background start not allowed: service Intent { act=com.google.firebase.MESSAGING_EVENT pkg=in.dailydelivery.dailydelivery cmp=in.dailydelivery.dailydelivery/.MyFirebaseMessagingService (has extras) } to in.dailydelivery.dailydelivery/.MyFirebaseMessagingService from pid=26445 uid=10210 pkg=in.dailydelivery.dailydelivery 2019-01-24 11:14:08.311 26445-26445/?
E/FirebaseInstanceId: Error while delivering the message: ServiceIntent not found
Please help me out.
Sandeep.

For FCM to deliver the message to app in foreground/background to create notification on notification bar the message format being send from app server should match the following format, please note Notification Message won't receive any callback when app is background, only Data message will receive
Notification Message format:
{
"message":{
"token":"bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
"notification":{
"title":"Portugal vs. Denmark",
"body":"great match!"
}
}
}
Data message:
{
"message":{
"token":"bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
"data":{
"Nick" : "Mario",
"body" : "great match!",
"Room" : "PortugalVSDenmark"
}
}
}
Refer below link for more details
https://firebase.google.com/docs/cloud-messaging/concept-options#setting-the-priority-of-a-message
For fcm to deliver the push notification when device is locked or in background, the message from app server should have the following tags
{
....
"android": {"priority":"high"},
"priority": 10,
....
}
Refer below for more details
https://firebase.google.com/docs/cloud-messaging/concept-options#setting-the-priority-of-a-message

Messages with both notification and data payload, when received in the background. In this case, the notification is delivered to the device’s system tray, and the data payload is delivered in the extras of the intent of your launcher Activity.
Handling Messages: Receive messages in an Android app

You need to declare the service in the application tag of your Manifest.
see this sample code.
To know more, please check this guide.

Related

Firebase messaging service never calls onMessageReceived() in the new versions

I'm trying to send the click-action data with the notification to handle the onClick event for it but unfortunately the app receives no data through the onMessageReceived(). I have tried plenty of things but all in vain.
Here is my code:
#Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
String notification_title =
remoteMessage.getNotification().getTitle();
String notification_message =
remoteMessage.getNotification().getBody();
String click_action =
remoteMessage.getNotification().getClickAction();
String from_user_id = remoteMessage.getData().get("from_user");
Log.v("user id", from_user_id);
if(from_user_id!= null){
Toast.makeText(this, from_user_id, Toast.LENGTH_SHORT).show();
}
NotificationCompat.Builder mBuilder = new
NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle(notification_title)
.setContentText(notification_message)
.setPriority(NotificationCompat.PRIORITY_DEFAULT);
Intent resultIntent = new Intent(click_action);
resultIntent.putExtra("user_id", from_user_id);
Log.v("user id", from_user_id);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addNextIntentWithParentStack(resultIntent);
PendingIntent resultPendingIntent =
stackBuilder.getPendingIntent(0,
PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(resultPendingIntent);
int mNotificationID = (int)System.currentTimeMillis();
NotificationManager mNotifyManger =
(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
mNotifyManger.notify(mNotificationID, mBuilder.build());
}
and here is my mainfest:
<service android:name=".FirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
and this is my gradle:
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-database:16.0.3'
implementation 'com.google.firebase:firebase-storage:16.0.3'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.firebaseui:firebase-ui-database:4.2.1'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
Edited:
Here is the data I'm expecting:
const deviceToken =
admin.database().ref(`/Users/${user_id}/device_token`).once('value');
return deviceToken.then(result => {
if (!result || !result.exists){throw new Error("Profile doesn't exist")}
const token_id = result.val();
const payload = {
notification: {
title: "New Friend Request",
body: `${userName} has sent you a Friend Request`,
icon: "default",
click_action: "com.example.alaa.lapitchatapp.Target_Notification"
},
data:{
from_user: from_user_id
}
};
If your RemoteMessage contains notification key onMessageReceived is only called if your app in background.
Move notification part into data. If you have notification setup from the request, FCM uses system notification tray to display the notification you wouldn't have any control over it, On the other hand if you need to process the push response, You should avoid using the notification part in the request
const payload = {
data:{
from_user: from_user_id,
title: "New Friend Request",
body: `${userName} has sent you a Friend Request`,
icon: "default",
click_action: "com.example.alaa.lapitchatapp.Target_Notification"
}
};
Firstly, are you passing your device's firebase ID in the payload? If yes, Please update your payload body mentioned. I don't see it there.
Your payload must have the firebase ID something like this :
"registration_ids":[
"your device's firebase ID"
]
or
"to":"your device's firebase ID"
or
"token":"your device's firebase ID"
Secondly, I don't see the point of this code :
if (true) {
Log.d(TAG, "Message data payload: there is not a problem");
} else {
// Handle message within 10 seconds
Log.d(TAG, "Message data payload: there is a problem");
}
What is the point of an else for an if statement which is always true?
Thirdly, the click action value you have given in the payload - com.example.alaa.lapitchatapp.Target_Notification
Is this a class you are trying to open on click of the notification?
I've found the answer to my question after too much digging in the firebase documentation.
You'll find it there:
Firebase Message Service not called but one time only
Thank you All.

Error when push notification by postman but not when send by Firebase console [duplicate]

I'm building an Android app which will receive push notifications. I've got Firebase Cloud Messaging setup and pretty much working, such that I can send the following payload to a valid token and the notification and data are received.
Using url https://fcm.googleapis.com/fcm/send
{
"to":"<valid-token>",
"notification":{"body":"BODY TEXT","title":"TITLE TEXT","sound":"default"},
"data":{"message":"This is some data"}
}
My app receives it correctly and can deal with it.
The only slight wrinkle is that I get the following exception thrown in the debug:
Error while parsing timestamp in GCM event
java.lang.NumberFormatException: Invalid int: "null"
at java.lang.Integer.invalidInt(Integer.java:138)
...
It doesn't crash the app, it just looks untidy.
I've tried adding a timestamp item to the main payload, the notification, the data, and also tried variations such as time but can't seem to get rid of the exception (and google as I might, I can't find an answer).
How do I pass the timestamp so it stops complaining?
Edited: Here is my onMessageReceived method, but I think the exception is thrown before it gets here
#Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.d(TAG, "From: " + remoteMessage.getFrom());
// Check if message contains a data payload.
if (remoteMessage.getData().size() > 0) {
Log.d(TAG, "Message data payload: " + remoteMessage.getData());
//TODO Handle the data
}
// Check if message contains a notification payload.
if (remoteMessage.getNotification() != null) {
Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody());
}
}
Thanks in advance,
Chris
Even though notification is apparently a supported element (according to the Firebase web docs), the only way I could get rid of the exception was to remove it entirely, and use the data section only, and then in my app create a notification (rather than letting firebase do the notification).
I used this site to work out how to raise the notifications: https://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/
My notification now looks like the following:
$fields = array("to" => "<valid-token>",
"data" => array("data"=>
array(
"message"=>"This is some data",
"title"=>"This is the title",
"is_background"=>false,
"payload"=>array("my-data-item"=>"my-data-value"),
"timestamp"=>date('Y-m-d G:i:s')
)
)
);
...
<curl stuff here>
...
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
My onMessageReceived looks like this:
#Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.d(TAG, "From: " + remoteMessage.getFrom());
// Check if message contains a data payload.
if (remoteMessage.getData().size() > 0) {
Log.e(TAG, "Data Payload: " + remoteMessage.getData().toString());
try {
JSONObject json = new JSONObject(remoteMessage.getData().toString());
handleDataMessage(json);
} catch (Exception e) {
Log.e(TAG, "Exception: " + e.getMessage());
}
}
}
which calls handleDataMessage which looks like this:
private void handleDataMessage(JSONObject json) {
Log.e(TAG, "push json: " + json.toString());
try {
JSONObject data = json.getJSONObject("data");
String title = data.getString("title");
String message = data.getString("message");
boolean isBackground = data.getBoolean("is_background");
String timestamp = data.getString("timestamp");
JSONObject payload = data.getJSONObject("payload");
// play notification sound
NotificationUtils notificationUtils = new NotificationUtils(getApplicationContext());
notificationUtils.playNotificationSound();
if (!NotificationUtils.isBackgroundRunning(getApplicationContext())) {
// app is in foreground, broadcast the push message
Intent pushNotification = new Intent(ntcAppManager.PUSH_NOTIFICATION);
pushNotification.putExtra("message", message);
LocalBroadcastManager.getInstance(this).sendBroadcast(pushNotification);
} else {
// app is in background, show the notification in notification tray
Intent resultIntent = new Intent(getApplicationContext(), MainActivity.class);
resultIntent.putExtra("message", message);
showNotificationMessage(getApplicationContext(), title, message, timestamp, resultIntent);
}
} catch (JSONException e) {
Log.e(TAG, "Json Exception: " + e.getMessage());
} catch (Exception e) {
Log.e(TAG, "Exception: " + e.getMessage());
}
}
this then calls showNotificationMessage
/**
* Showing notification with text only
*/
private void showNotificationMessage(Context context, String title, String message, String timeStamp, Intent intent) {
notificationUtils = new NotificationUtils(context);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
notificationUtils.showNotificationMessage(title, message, timeStamp, intent);
}
And subsequently notificationUtils.showNotificationMessage
public void showNotificationMessage(String title, String message, String timeStamp, Intent intent) {
showNotificationMessage(title, message, timeStamp, intent, null);
}
public void showNotificationMessage(final String title, final String message, final String timeStamp, Intent intent, String imageUrl) {
// Check for empty push message
if (TextUtils.isEmpty(message))
return;
// notification icon
final int icon = R.mipmap.ic_launcher;
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
final PendingIntent resultPendingIntent =
PendingIntent.getActivity(
mContext,
0,
intent,
PendingIntent.FLAG_CANCEL_CURRENT
);
final NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
mContext);
final Uri alarmSound = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE
+ "://" + mContext.getPackageName() + "/raw/notification");
showSmallNotification(mBuilder, icon, title, message, timeStamp, resultPendingIntent, alarmSound);
playNotificationSound();
}
private void showSmallNotification(NotificationCompat.Builder mBuilder, int icon, String title, String message, String timeStamp, PendingIntent resultPendingIntent, Uri alarmSound) {
NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
inboxStyle.addLine(message);
Notification notification;
notification = mBuilder.setSmallIcon(icon).setTicker(title).setWhen(0)
.setAutoCancel(true)
.setContentTitle(title)
.setContentIntent(resultPendingIntent)
.setSound(alarmSound)
.setStyle(inboxStyle)
.setWhen(getTimeMilliSec(timeStamp))
.setSmallIcon(R.mipmap.ic_launcher)
.setLargeIcon(BitmapFactory.decodeResource(mContext.getResources(), icon))
.setContentText(message)
.build();
NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(ntcAppManager.NOTIFICATION_ID, notification);
}
More detail in the link above, and it's a lot of handling but at least the exception's gone and I'm in control of the notifications.
I've updated com.google.firebase:firebase-messaging to 17.3.4 and issue disappeared.
I was running into this same error, I resolved by adding a ttl value to the payload.
{
"to":"<valid-token>",
"notification":{"body":"BODY TEXT","title":"TITLE TEXT","sound":"default"},
"data":{"message":"This is some data"},
"ttl": 3600
}
I had the same problem, I've just set "body" parameter in notification and error dissapeared.
What worked for me:
Upgrading, not only firebase-messaging, but all Firebase libraries to the last version. In android/app/build.gradle:
dependencies {
implementation "com.google.firebase:firebase-core:16.0.0" // upgraded
implementation "com.google.firebase:firebase-analytics:16.0.0" // upgraded
implementation 'com.google.firebase:firebase-messaging:17.3.4' // upgraded
// ...
implementation "com.google.firebase:firebase-invites:16.0.0" // upgraded
// ...
}
Not all of them are at version 17.x
Format below (no notification body, nor are there any arrays) fixed the timestamp exception for me:
{
"to": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"data": {
"message": "message",
"title": "hello",
}
}
Tested fine with http://pushtry.com/
The only reason I included the long 'eeee...' is that is the exact size of my token.
replace
"notification" : {
"title" : "title !",
"body" : "body !",
"sound" : "default"
},
"condition" : "'xxx' in topics",
"priority" : "high",
"data" : {
....
by (remove notification) :
{
"condition" : "'xxxx' in topics",
"priority" : "high",
"data" : {
"title" : "title ! ",
"body" : "BODY",
......
}
And on you code :
Replace :
#Override
public void onMessageReceived(RemoteMessage remoteMessage) {
remoteMessage.getNotification().getTitle();
remoteMessage.getNotification().getBody();
}
by
#Override
public void onMessageReceived(RemoteMessage remoteMessage) {
remoteMessage.getData().get("title");
remoteMessage.getData().get("body");
}
In my case My error was "AndrodManifest.xml"
I miss one service (actually Android studio's firebase assistant is missing my permission. :) )
original
<service android:name=".fcm.MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
</application>
solution
<service android:name=".fcm.MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service android:name=".fcm.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
</application>

Firebase Push Notification Doesn't Replace the Exisiting Notification

I'm creating a chat application which send push notifications using firebase
as my chatApp goes in background and send push notifications in row it generate new notification everytime as i have created a unique notification id for it.
I want to group to notification or update the existing one.
Image that Doesnt Group Firebase Push Notifications
Here is my Code of Firebase Messaging Service
public class MyFirebaseMessagingService extends FirebaseMessagingService {
public int no_of_messages = 0,i=0;
private int notify_id= 12121; // this was my actual code
#Override
public void onMessageReceived(RemoteMessage remoteMessage) {
showNotification(remoteMessage, remoteMessage.getData().get("message"));
no_of_messages++;
}
private void showNotification(RemoteMessage remoteMessage, String message) {
Intent i = new Intent(remoteMessage.getNotification().getClickAction());
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Uri notification = Uri.parse("android.resource://"
+ this.getPackageName() + "/" + R.raw.coin);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
PendingIntent pendingIntent;
pendingIntent = PendingIntent.getActivity(this, 0, i, PendingIntent.FLAG_UPDATE_CURRENT);
if (no_of_messages == 0) {
builder.setAutoCancel(true)
.setContentTitle(remoteMessage.getNotification().getTitle())
.setContentText(remoteMessage.getNotification().getBody())
.setSmallIcon(R.drawable.auto)
.setSound(notification)
.setNumber(no_of_messages)
.setContentIntent(pendingIntent);
} else {
builder.setContentTitle(no_of_messages+"New Messages")
.setNumber(no_of_messages)
.setContentText(remoteMessage.getNotification().getTitle());
}
NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
manager.notify(notify_id, builder.build());
}
}
PHP script
function for sending to FCM
function send_to_fcm($token,$title,$message,$click_action){
$body = array("to"=>$token."",
"notification" => array(
"title" => $title ,
"body"=> $message,
"click_action"=>$click_action,
'vibrate' => 1,
'sound' => "coin",
'largeIcon' => 'large_icon',
'smallIcon' => 'small_icon'
)
);
echo json_encode($body);
$header = array("Authorization:key=".FCM_SERVER_KEY,"Content-type:application/json");
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, FCM_PATH);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
$buffer = curl_exec($ch);
curl_close($ch);
//echo $buffer;
}
For update existing notification notify_id must be same as older one.
if notify_id will be changed it will generate new notification will not update existing one.
I am using below code for check message contain data payload or notification payload (notification payload contains notification from PHP)
if (remoteMessage.getData().size() > 0) {
Log.d(TAG, "Message data payload: " + remoteMessage.getData());
title = remoteMessage.getData().get("title");
message = remoteMessage.getData().get("body");
image = remoteMessage.getData().get("icon");
}
// Check if message contains a notification payload.
if (remoteMessage.getNotification() != null) {
Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody());
title = remoteMessage.getNotification().getTitle();
message = remoteMessage.getNotification().getBody();
image = remoteMessage.getData().get("image");
}
In order to replace the notify_id must be same as previous. Use some constant value.
[ FIX ]
So there was a problem in PHP script
I Used "notification" as parameter for sending Notification
i Changed it to "data" which solved my problem
here is PHP Script
$body = array("to"=>$token."",
"data" => array(
"title" => $title ,
"body"=> $message,
"click_action"=>$click_action,
'vibrate' => 1,
'sound' => "coin",
'largeIcon' => 'large_icon',
'smallIcon' => 'small_icon'
)
);
and
MyFirebaseMessangingClass
Intent i = new Intent(remoteMessage.getData().get("click_action"));
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Uri notification = Uri.parse("android.resource://"
+ this.getPackageName() + "/" + R.raw.coin);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
PendingIntent pendingIntent;
pendingIntent = PendingIntent.getActivity(this, 0, i, PendingIntent.FLAG_UPDATE_CURRENT);
if (no_of_messages == 0) {
builder.setAutoCancel(true)
.setContentTitle(remoteMessage.getData().get("title"))
.setContentText(remoteMessage.getData().get("body"))
.setSmallIcon(R.mipmap.ic_launcher)
.setSound(notification)
.setNumber(no_of_messages)
.setContentIntent(pendingIntent);
no_of_messages++;
} else {
builder.setContentTitle("Eaziche | "+no_of_messages+" New Messages")
.setNumber(no_of_messages)
.setSmallIcon(R.mipmap.ic_launcher)
.setSound(notification)
.setNumber(no_of_messages)
.setContentIntent(pendingIntent)
.setContentText(remoteMessage.getData().get("title"));
}
NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
manager.notify(notify_id, builder.build()); // notify_id = 12121

Firebase (FCM): open activity and pass data on notification click. android

There should be clear implementation of how to work with Firebase notification and data. I read many answers but can't seem to make it work. here are my steps:
1.) I am passing notification and data to android in PHP and it seems to be fine:
$msg = array
(
"body" => $body,
"title" => $title,
"sound" => "mySound"
);
$data = array
(
"user_id" => $res_id,
"date" => $date,
"hal_id" => $hal_id,
"M_view" => $M_view
);
$fields = array
(
'registration_ids' => $registrationIds,
'notification' => $msg,
'data' => $data
);
$headers = array
(
'Authorization: key='.API_ACCESS_KEY,
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL, 'https://android.googleapis.com/gcm/send' );
curl_setopt( $ch,CURLOPT_POST, true );
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
$result = curl_exec($ch );
curl_close( $ch );
2.) when notification and data is received in Android it shows notification. When I click on this notification it opens app. But I can not figure out the way to handle the data when the app is opened. There are couple differences when app is in foreground and backround. The code that I have now is the following:
public class MyFirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG = "MyFirebaseMsgService";
#Override
public void onMessageReceived(RemoteMessage remoteMessage) {
String user_id = "0";
String date = "0";
String cal_id = "0";
String M_view = "0";
if (remoteMessage.getData().size() > 0) {
Log.d(TAG, "Message data payload: " + remoteMessage.getData());
user_id = remoteMessage.getData().get("user_id");
date = remoteMessage.getData().get("date");
hal_id = remoteMessage.getData().get("hal_id");
M_view = remoteMessage.getData().get("M_view");
}
//Calling method to generate notification
sendNotification(remoteMessage.getNotification().getBody(), user_id, date, hal_id, M_view);
}
private void sendNotification(String messageBody, String user_id, String date, String hal_id, String M_view) {
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra("fcm_notification", "Y");
intent.putExtra("user_id", user_id);
intent.putExtra("date", date);
intent.putExtra("hal_id", hal_id);
intent.putExtra("M_view", M_view);
int uniqueInt = (int) (System.currentTimeMillis() & 0xff);
PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), uniqueInt, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this);
notificationBuilder.setSmallIcon(R.drawable.ic_launcher)
.setContentText(messageBody)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0, notificationBuilder.build());
}}
3.) When I use the code above and when I click on notification all it does it opens the app if in background. If app in foreground then on notification click it simply dismisses notification. However, I want to receive data and open specific Activity in both scenarios (background and foreground). I have in MainActivity the following code, but I am not able to get data. fcm_notification, date, hal_id returns null.
public class MainActivity extends Activity {
UserFunctions userFunctions;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
#Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
Intent intent_o = getIntent();
}
#Override
protected void onResume() {
super.onResume();
userFunctions = new UserFunctions();
if(userFunctions.isUserLoggedIn(getApplicationContext())){
Intent intent_o = getIntent();
String fcm_notification = intent_o.getStringExtra("fcm_notification") ;
String user_id = intent_o.getStringExtra("user_id");
String date = intent_o.getStringExtra("date");
String hal_id = intent_o.getStringExtra("hal_id");
String M_view = intent_o.getStringExtra("M_view");
Intent intent = new Intent(this, JobList.class);
// THIS RETURNS NULL, user_id = null
System.out.print("FCM" + user_id);
startActivity(intent);
finish();
}else{
// user is not logged in show login screen
Intent login = new Intent(this, LoginActivity.class);
startActivity(login);
// Closing dashboard screen
finish();
}
}}
IF anyone can direct or advice how can I retrieve data in MainActivity.java from Firebase in either scenario (foreground or background) that would be fantastic.
So first off, I'll put in the detail mentioned in the Handling Messages docs.
In the summary under the Both row, it shows that when the app is on foreground, the payload will be handled in your onMessageReceived().
In order to open the activity from onMessageReceived(), you should check if the data you need is in the payload, if it does, call your specific activity then pass all the other details you need via intent.
Now if the app is in background, it is mentioned in the docs that the notification is received by the Android system tray and that the data payload can be retrieved from the extras of the intent.
Just adding in the details from my answer here which pretty much just gives the docs statement and a link to a sample:
Handle notification messages in a backgrounded app
When your app is in the background, Android directs notification messages to the system tray. A user tap on the notification opens the app launcher by default.
This includes messages that contain both notification and data payload (and all messages sent from the Notifications console). In these cases, the notification is delivered to the device's system tray, and the data payload is delivered in the extras of the intent of your launcher Activity.
I think this answer by #ArthurThompson explains it very well:
When you send a notification message with a data payload (notification and data) and the app is in the background you can retrieve the data from the extras of the intent that is launched as a result of the user tapping on the notification.
From the FCM sample which launches the MainActivity when the notification is tapped:
if (getIntent().getExtras() != null) {
for (String key : getIntent().getExtras().keySet()) {
String value = getIntent().getExtras().getString(key);
Log.d(TAG, "Key: " + key + " Value: " + value);
}
}
After trying all the answers and blogs came up with solution. if anyone needs please use this video as reference
https://www.youtube.com/watch?v=hi8IPLNq59o
IN ADDITION to the video to add intents do in MyFirebaseMessagingService:
public class MyFirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG = "MyFirebaseMsgService";
#Override
public void onMessageReceived(RemoteMessage remoteMessage) {
String user_id = "0";
String date = "0";
String hal_id = "0";
String M_view = "0";
if (remoteMessage.getData().size() > 0) {
Log.d(TAG, "Message data payload: " + remoteMessage.getData());
user_id = remoteMessage.getData().get("user_id");
date = remoteMessage.getData().get("date");
cal_id = remoteMessage.getData().get("hal_id");
M_view = remoteMessage.getData().get("M_view");
}
String click_action = remoteMessage.getNotification().getClickAction();
//Calling method to generate notification
sendNotification(remoteMessage.getNotification().getBody(), remoteMessage.getNotification().getTitle(), user_id, date, hal_id, M_view, click_action);
}
private void sendNotification(String messageBody, String messageTitle, String user_id, String date, String hal_id, String M_view, String click_action) {
Intent intent = new Intent(click_action);
intent.putExtra("user_id", user_id);
intent.putExtra("date", date);
intent.putExtra("hal_id", hal_id);
intent.putExtra("M_view", M_view);
PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent,
PendingIntent.FLAG_ONE_SHOT);
Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this);
notificationBuilder.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle(messageTitle)
.setContentText(messageBody)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0, notificationBuilder.build());
}}
and in new NotificationReceive activity in onCreate or onResume add this
notification_Y_N = (TextView) findViewById(R.id.notification_Y_N);
user_id_text = (TextView) findViewById(R.id.user_id_text);
Intent intent_o = getIntent();
String user_id = intent_o.getStringExtra("user_id");
String date = intent_o.getStringExtra("date");
String hal_id = intent_o.getStringExtra("hal_id");
String M_view = intent_o.getStringExtra("M_view");
notification_Y_N.setText(date);
user_id_text.setText(hal_id);
To invoke the onMessageReceived() method you will need to use another method to send notifications (like creating a Web API to send notifications). Then using it,
remove the notification payload from your FCM messages in order to have the data payload delivered to the onMessageReceived() method.
When your app is in the background, data payload is delivered to the onMessageReceived method only if there is no notification payload.
In case both payloads exist then system automatically handles the
notification part (system tray) and your app gets the data payload in
the extras of the intent of launcher Activity (after the user tap on
the notification).
For more info please refer to the following links:
Why is this happening? How to? How to handle push notifications?
Original answer by kws. Give him an upvote.
You don't need to implement sendNotification and onMessageReceived yourself.
When sending:
$data = array
(
"user_id" => $res_id
//whatever fields you want to include
);
$msg = array
(
"body" => $body,
"title" => $title,
"data" => $data
// more fields
);
android side (on your MainACtivity:
private void handleIntent(Intent intent) {
String user_id= intent.getStringExtra("user_id");
if(user_id!= null)
Log.d(TAG, user_id);
}
and of course:
#Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
handleIntent(intent);
}
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
handleIntent(getIntent());
}
whatever fields you put in data will be sent to your intent extra.
firstly, if you have data object and notification object in response . then ask the backend developer to remove notification object.
i hope my own class help .
public class MyFirebaseService extends FirebaseMessagingService {
private static final String TAG = "MyFirebaseService";
#Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
// Check if message contains a data payload.
if (remoteMessage.getData().size() > 0) {
Log.d(TAG, "Message data payload: " + remoteMessage.getData());
Log.d(TAG, "Message data payload:id " + remoteMessage.getData().get("mode_id"));
sendNotification(remoteMessage.getData().get("body"),
remoteMessage.getData().get("mode_id"), remoteMessage.getData().get("click_action"));
}
}
private void sendNotification(String messageBody, String id, String clickAction) {
Intent intent = new Intent(clickAction);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addNextIntentWithParentStack(intent);
intent.putExtra("id", id);
intent.putExtra("body", messageBody);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TASK);
PendingIntent pendingIntent =
stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, "111")
.setSmallIcon(R.drawable.venus_logo)
.setContentText(messageBody)
.setAutoCancel(true)
.setVibrate(new long[]{1000, 1000, 1000, 1000, 1000})
.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
.setContentIntent(pendingIntent)
.setLights(Color.GREEN, 3000, 3000);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
int importance = NotificationManager.IMPORTANCE_HIGH;
NotificationChannel notificationChannel = new NotificationChannel("111", "NOTIFICATION_CHANNEL_NAME", importance);
notificationChannel.enableLights(true);
notificationChannel.setLightColor(Color.RED);
notificationChannel.enableVibration(true);
notificationChannel.setShowBadge(false);
notificationChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400});
assert notificationManager != null;
notificationBuilder.setChannelId("111");
notificationManager.createNotificationChannel(notificationChannel);
notificationManager.notify(0, notificationBuilder.build());
} else {
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
notificationManager.notify(0, notificationBuilder.build());
}
}
}
then add this to your manifest file .
<service
android:name=".data.services.MyFirebaseService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<activity
android:name=".ui.notifications.NotificationsDetailsActivity"
android:excludeFromRecents="true"
android:launchMode="singleTask"
android:parentActivityName=".ui.home.HomeActivity"
android:taskAffinity="">
<intent-filter>
<action android:name="co.example.yourApp.ui.notifications_TARGET_NOTIFICATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Firebase documentation has a great table to explain how it works
https://firebase.google.com/docs/cloud-messaging/android/receive#handling_messages
So if you have both data and notification and app is in a foreground when your receive it then you should create a notification by yourself in your service which extends FirebaseMessagingService (in onMessageReceived method)
In other case (app is in background) you can get your data from intent.extras of Activity, a notification will be created by a system to open main activity of the app

Android not receiving Firebase Push Notification - MismatchSenderId

I'm trying to work on a messenger app, but the twist here is I have 2 Entities (i.e. 2 apps A & B) here.
Now I'm trying to put messaging logic between the two using Firebase. Firebase doesn't support communication between two different applications (A & B) over the same project url. In order to overcome that restriction, I have used the same google-service.json of app A for app B as well.
For app B, I have just changed the project id and auth key. That seems to have worked as I intended. I have tested the push notification as well using the Firebase Console and it seemed to have been working.
Then I have tried to implement the server logic. To make one-on-one notification.
CASE 1
But the problem arises here is that from app B, if I send a notification request, I get a MismatchSenderId error where the project id has not been tempered with.
{"multicast_id":[removed],"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"MismatchSenderId"}]}
CASE 2
and for app A, here is the following response I get:
{"multicast_id":[removed],"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1473661851590851%0e4bcac9f9fd7ecd"}]}
For this, the success value is 1 hence, the notification should be sent but it's not sending when I'm making the request from the device. But it works flawlessly when I perform the same server call using Postman or any other client.
Here are my codes MyFirebaseInstanceIDService.java
public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService {
private static final String TAG = "MyFirebaseIIDService";
private static final String FRIENDLY_ENGAGE_TOPIC = "friendly_engage";
#Override
public void onCreate() {
String savedToken = Utility.getFirebaseInstanceId(getApplicationContext());
String defaultToken = getApplication().getString(R.string.pref_firebase_instance_id_default_key);
Log.d("GCM", savedToken);
if (savedToken.equalsIgnoreCase(defaultToken))
//currentToken is null when app is first installed and token is not available
//also skip if token is already saved in preferences...
{
String CurrentToken = FirebaseInstanceId.getInstance().getToken();
if (CurrentToken != null)
Utility.setFirebaseInstanceId(getApplicationContext(), CurrentToken);
Log.d("Value not set", CurrentToken);
updateFCMTokenId(CurrentToken);
}
super.onCreate();
}
/**
* The Application's current Instance ID token is no longer valid
* and thus a new one must be requested.
*/
#Override
public void onTokenRefresh() {
// If you need to handle the generation of a token, initially or
// after a refresh this is where you should do that.
String token = FirebaseInstanceId.getInstance().getToken();
Log.d(TAG, "FCM Token: " + token);
Utility.setFirebaseInstanceId(getApplicationContext(), token);
updateFCMTokenId(token);
}
private void updateFCMTokenId(final String token) {
SQLiteHandler db = new SQLiteHandler(getBaseContext());
final HashMap<String, String> map = db.getUserDetails();
//update fcm token for push notifications
StringRequest str = new StringRequest(Request.Method.POST, AppConfig.UPDATE_GCM_ID, new Response.Listener<String>() {
#Override
public void onResponse(String response) {
Log.d("GCM RESPONSE", response);
}
}, new Response.ErrorListener() {
#Override
public void onErrorResponse(VolleyError error) {
}
}) {
#Override
protected Map<String, String> getParams() throws AuthFailureError {
HashMap<String, String> param = new HashMap<>();
param.put("user_id", map.get("uid"));
param.put("gcm_registration_id", token);
return param;
}
};
str.setShouldCache(false);
str.setRetryPolicy(new DefaultRetryPolicy(AppConfig.DEFAULT_RETRY_TIME, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
AppController.getInstance().addToRequestQueue(str);
}
}
FirebaseMessagingService.java
public class MyFirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG = "MyFirebaseMsgService";
#Override
public void onMessageReceived(RemoteMessage remoteMessage) {
//Displaying data in log
//It is optional
try {
Log.d(TAG, "From: " + remoteMessage.getFrom());
Log.d(TAG, "Notification Message Body: " + remoteMessage.getData().get("message"));
} catch (Exception e) {
e.printStackTrace();
}
//Calling method to generate notification
sendNotification(remoteMessage.getData().get("message"));
}
//This method is only generating push notification
//It is same as we did in earlier posts
private void sendNotification(String messageBody) {
Intent intent = new Intent(this, ChatRoomActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent,
PendingIntent.FLAG_ONE_SHOT);
Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
android.support.v4.app.NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle("NAME")
.setContentText(messageBody)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0, notificationBuilder.build());
}
}
And here is the declaration in the Manifest.xml within Application tag
<service
android:name=".MyFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service
android:name=".MyFirebaseInstanceIDService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
TIA
CASE 1 Solved
I have managed to solve CASE 1 where for B I had to use the server api key of B , similarly for A
EDIT 2
Added Server side code
public function sendNotification($message, $gcm_id, $user_level)
{
if ($user_level == "level") {
$server_key = "xys";
} else $server_key = "ABC";
$msg = array
(
'message' => $message,
'title' => 'Title',
'vibrate' => 1,
'sound' => 1,
'largeIcon' => 'large_icon',
'smallIcon' => 'small_icon'
);
$fields = array
(
'to' => $gcm_id,
'data' => $msg
);
$headers = array
(
'Authorization: key=' . $server_key,
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
curl_close($ch);
echo $result;
}
Edit #1:
1) Make sure you are sending a valid json to the fcm.
2) Make sure you are sending to the right token.
Other informations on how to send notifications:
Send messages to specific devices
To send messages to specific devices, set the to the registration token for the specific app instance
curl -H "Content-type: application/json" -H "Authorization:key=<Your Api key>" -X POST -d '{ "data": { "score": "5x1","time": "15:10"},"to" : "<registration token>"}' https://fcm.googleapis.com/fcm/send
Send messages to topics
here the topic is : /topics/foo-bar
curl -H "Content-type: application/json" -H "Authorisation:key=<Your Api key>" -X POST -d '{ "to": "/topics/foo-bar","data": { "message": "This is a Firebase Cloud Messaging Topic Message!"}}' https://fcm.googleapis.com/fcm/send
Send messages to device groups
Sending messages to a device group is very similar to sending messages to an individual device. Set the to parameter to the unique notification key for the device group
curl -H "Content-type: application/json" -H "Authorisation:key=<Your Api key>" -X POST -d '{"to": "<aUniqueKey>","data": {"hello": "This is a Firebase Cloud Messaging Device Group Message!"}}' https://fcm.googleapis.com/fcm/send
Original:
The problem is you server configuration. If you want to manage two firebase apps in single server you have you have to config two firebase apps with your Firebase APK_KEY that located at:
Go to your applications in Firebase console -> Click on three dots at the top right -> Manage -> CLOUD MESSAGES -> (Server key)
After you get your both server keys for your two apps, you have to configure it like this:
var firebaseLib = require("firebase");
var app1Config = {
apiKey: "<PROJECT_1_API_KEY>",
authDomain: "<PROJECT_1_ID>.firebaseapp.com",
databaseURL: "https://<PROJECT_1_DATABASE_NAME>.firebaseio.com",
storageBucket: "<PROJECT_1_BUCKET>.appspot.com",
}
var app2Config = {
apiKey: "<PROJECT_2_API_KEY>",
authDomain: "<PROJECT_2_ID>.firebaseapp.com",
databaseURL: "https://<PROJECT_2_DATABASE_NAME>.firebaseio.com",
storageBucket: "<PROJECT_2_BUCKET>.appspot.com",
}
var firebaseApp1 = firebaseLib.initailize(app1Config); // Primary
var firebaseApp2 = firebaseLib.initailize(app2Config, "Secondary"); // Secondary
I fixed error MismatchSenderId
Example, below:
valid token: cwsm26j-8qM:APA91bEGbg5xxxxxxxxxxxxxxxxxxxxxx
invalid token: APA91bEGbg5xxxxxxxxxxxxxxxxxxxxxx

Categories

Resources