Files
mattermost-mobile/android/app/src/main/java/com/mattermost/rnbeta/NotificationDismissService.java
Elias Nahum 1777a4f750 MM-14316 Android Notifications and reply to notifications from native code (#2653)
* MM-14316 Android Notifications and reply to notifications from native code

* Feedback review

* Fix typo

* setBadgeIconType only for Android 8+
2019-03-20 16:39:36 -03:00

27 lines
956 B
Java

package com.mattermost.rnbeta;
import android.content.Context;
import android.content.Intent;
import android.app.IntentService;
import android.os.Bundle;
import android.util.Log;
import com.wix.reactnativenotifications.core.NotificationIntentAdapter;
public class NotificationDismissService extends IntentService {
private Context mContext;
public NotificationDismissService() {
super("notificationDismissService");
}
@Override
protected void onHandleIntent(Intent intent) {
mContext = getApplicationContext();
Bundle bundle = NotificationIntentAdapter.extractPendingNotificationDataFromIntent(intent);
int notificationId = intent.getIntExtra(CustomPushNotification.NOTIFICATION_ID, -1);
String channelId = bundle.getString("channel_id");
CustomPushNotification.clearNotification(mContext, notificationId, channelId);
Log.i("ReactNative", "Dismiss notification");
}
}