Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response is always true #2

Open
ABrumm opened this issue Jul 11, 2019 · 5 comments
Open

Response is always true #2

ABrumm opened this issue Jul 11, 2019 · 5 comments

Comments

@ABrumm
Copy link

ABrumm commented Jul 11, 2019

Response of calling checkNoticficationPermission is always false.

@Eaffy
Copy link
Owner

Eaffy commented Jul 11, 2019

I'm checking this issue in the latest version of react-native.

@Eaffy
Copy link
Owner

Eaffy commented Jul 11, 2019

@ABrumm Which version of you react-native

@Eaffy
Copy link
Owner

Eaffy commented Jul 11, 2019

I have tested in the latest version of react-native, It run well

@ABrumm
Copy link
Author

ABrumm commented Jul 11, 2019

@Eaffy i tested this plugin on react-native 0.55.4

@ABrumm
Copy link
Author

ABrumm commented Jul 11, 2019

I fixed my Problem with an own implementation of an notification permission check:

package *********;

 import androidx.core.app.NotificationManagerCompat;
 import com.facebook.react.bridge.Promise;
 import com.facebook.react.bridge.ReactApplicationContext;
 import com.facebook.react.bridge.ReactContext;
 import com.facebook.react.bridge.ReactContextBaseJavaModule;
 import com.facebook.react.bridge.ReactMethod;

public class PermissionCheckerModule extends ReactContextBaseJavaModule {
 ReactApplicationContext reactContext;

 public PermissionCheckerModule(ReactApplicationContext reactContext) {
   super(reactContext);
   this.reactContext = reactContext;
 }

 @Override
 public String getName() {
   return "RNPermissionChecker";
 }

 @ReactMethod
 public void checkPermissions(Promise promise) {
   ReactContext reactContext = getReactApplicationContext();
   NotificationManagerCompat managerCompat = NotificationManagerCompat.from(reactContext);
   promise.resolve(managerCompat.areNotificationsEnabled());
 }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants