|
@@ -31,7 +31,7 @@ import android.util.Log;
|
|
|
import com.google.firebase.messaging.FirebaseMessagingService;
|
|
|
import com.google.firebase.messaging.RemoteMessage;
|
|
|
import com.owncloud.android.R;
|
|
|
-import com.owncloud.android.ui.activity.FileDisplayActivity;
|
|
|
+import com.owncloud.android.lib.resources.notifications.models.Notification;
|
|
|
|
|
|
public class NCFirebaseMessagingService extends FirebaseMessagingService {
|
|
|
private static final String TAG = "NCFirebaseMessaging";
|
|
@@ -41,14 +41,11 @@ public class NCFirebaseMessagingService extends FirebaseMessagingService {
|
|
|
Log.d(TAG, "From: " + remoteMessage.getFrom());
|
|
|
Log.d(TAG, "Notification Message Body: " + remoteMessage.getNotification().getBody());
|
|
|
|
|
|
- //Calling method to generate notification
|
|
|
- sendNotification(remoteMessage.getNotification().getBody());
|
|
|
+ sendNotification(remoteMessage.getNotification().ge);
|
|
|
}
|
|
|
|
|
|
- //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, FileDisplayActivity.class);
|
|
|
+ private void sendNotification(String contentTitle) {
|
|
|
+ Intent intent = new Intent(this, NotificationsActivity.class);
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
|
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent,
|
|
|
PendingIntent.FLAG_ONE_SHOT);
|
|
@@ -56,9 +53,7 @@ public class NCFirebaseMessagingService extends FirebaseMessagingService {
|
|
|
Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
|
|
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
|
|
|
.setSmallIcon(R.mipmap.ic_launcher)
|
|
|
- .setContentTitle("Firebase Push Notification")
|
|
|
- .setContentText(messageBody)
|
|
|
- .setAutoCancel(true)
|
|
|
+ .setContentTitle(contentTitle)
|
|
|
.setSound(defaultSoundUri)
|
|
|
.setContentIntent(pendingIntent);
|
|
|
|