12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package com.owncloud.android.services.firebase;
- import com.evernote.android.job.JobRequest;
- import com.evernote.android.job.util.support.PersistableBundleCompat;
- import com.google.firebase.messaging.FirebaseMessagingService;
- import com.google.firebase.messaging.RemoteMessage;
- import com.owncloud.android.jobs.NotificationJob;
- public class NCFirebaseMessagingService extends FirebaseMessagingService {
- @Override
- public void onMessageReceived(RemoteMessage remoteMessage) {
- if (remoteMessage.getData() != null) {
- PersistableBundleCompat persistableBundleCompat = new PersistableBundleCompat();
- persistableBundleCompat.putString(NotificationJob.KEY_NOTIFICATION_SUBJECT, remoteMessage.getData().get
- (NotificationJob.KEY_NOTIFICATION_SUBJECT));
- persistableBundleCompat.putString(NotificationJob.KEY_NOTIFICATION_SIGNATURE, remoteMessage.getData().get
- (NotificationJob.KEY_NOTIFICATION_SIGNATURE));
- new JobRequest.Builder(NotificationJob.TAG)
- .addExtras(persistableBundleCompat)
- .setUpdateCurrent(false)
- .startNow()
- .build()
- .schedule();
- }
- }
- }
|