[android][messaging] Support for hasPermission using areNotificationsEnabled

This commit is contained in:
Gerardo Pacheco 2018-05-31 16:31:27 +02:00
parent bc0326b3bf
commit d5e4808061
1 changed files with 3 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.support.v4.content.LocalBroadcastManager; import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.app.NotificationManagerCompat;
import android.util.Log; import android.util.Log;
import com.facebook.react.bridge.Promise; import com.facebook.react.bridge.Promise;
@ -56,7 +57,8 @@ public class RNFirebaseMessaging extends ReactContextBaseJavaModule {
// Non Web SDK methods // Non Web SDK methods
@ReactMethod @ReactMethod
public void hasPermission(Promise promise) { public void hasPermission(Promise promise) {
promise.resolve(true); Boolean enabled = NotificationManagerCompat.from(getReactApplicationContext()).areNotificationsEnabled();
promise.resolve(enabled);
} }
@ReactMethod @ReactMethod