Can't use permissions API in SDK 29

After upgrading to SDK 29, I am getting an error when I try to request location permissions in my detached app:

Error: No visible activity. Must request location when visible.

I have replicated this in a fresh expo app by:
exp init
exp detach

Note: I got errors in android studio until I added expokit as a dependency in package.json

Once I have the default app up and running, I add componentDidMount in the default App.js and request location permission:


This gives the error:
[11:55:23] [Unhandled promise rejection: Error: No visible activity. Must request location when visible.]

  • node_modules\react-native\Libraries\BatchedBridge\NativeModules.js:121:42 in createErrorFromErrorData
  • node_modules\react-native\Libraries\BatchedBridge\NativeModules.js:78:57 in
  • … 5 more stack frames from framework internals

I am using exp version 55.0.5

Any advice or help with this would be appreciated.

1 Like

I Have the same Issue, on detached App

A fix was recently landed, which should fix this Permissions issue.
cc: @tsapeta @sjchmiela

1 Like

Hi all, I confirmed this issue exists, it happens due to a bug in DetachedModuleRegistryAdapter, which doesn’t add modules from ReactAdapterPackage to the module registry. I’ll fix this issue upstream and post here a quick workaround for detached applications in a bit.

1 Like

Hi all!

A quick workaround would be to:

  1. create your own subclass of ModuleRegistryAdapter.
  2. create your own subclass of UIManagerModuleWrapper.
  3. point MainActivity to use your ModuleRegistryAdapter subclass.

Classes for 1. and 2. can be found here:

To point to your subclass, override this method in MainActivity:

  public ExpoModuleRegistryAdapter getScopedModuleRegistryAdapterForPackages(List<Package> packages) {
    return new MyModuleRegistryAdapter(new ReactModuleRegistryProvider(packages));

Sorry for the inconvenience, we’re working on a fix. :slight_smile:


Hi all,
Thank you very much for getting back to me so quickly about this, I do appreciate it.

The workaround did the trick and everything is now working again.

I’ll keep an eye out for the upstream fix as well.

Thanks again for your help!

1 Like

@sjchmiela, this code works on develop mode, when i build a release APK, the Notifications requests stop working again.

    buildTypes {
        debug {
            debuggable true
            ext.enableCrashlytics = false
            signingConfig signingConfigs.configs
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile("proguard-android.txt"), ""
            zipAlignEnabled true
            signingConfig signingConfigs.configs

It Works by Removing ‘minifyEnabled’ and ‘proguardFiles’

        release {
            zipAlignEnabled true
            signingConfig signingConfigs.configs

Could you please clarify what do you mean by Notifications requests stop working? :slightly_smiling_face:

1 Like

When use Permission.asksync(…), do nothing!

1 Like

I’m also with the same issue. I created an “issue” on github and linked to this post.

Hi all, thanks for your patience?

Could you please follow the instructions I’ve put in and see if it helps to resolve the issue?

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.