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:
Permissions.askAsync(Permissions.LOCATION)
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:
create your own subclass of ModuleRegistryAdapter
.
create your own subclass of UIManagerModuleWrapper
.
point MainActivity
to use your ModuleRegistryAdapter
subclass.
Classes for 1. and 2. can be found here: https://gist.github.com/sjchmiela/cbe0738171be44feb04f6342a5c352b8
To point to your subclass, override this method in MainActivity
:
@Override
public ExpoModuleRegistryAdapter getScopedModuleRegistryAdapterForPackages(List<Package> packages) {
return new MyModuleRegistryAdapter(new ReactModuleRegistryProvider(packages));
}
Sorry for the inconvenience, we’re working on a fix.
2 Likes
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"), "proguard-rules.pro"
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 ?
1 Like
@sjchmiela
When use Permission.asksync(…), do nothing!
1 Like
manelpb
August 11, 2018, 10:43pm
11
I’m also with the same issue. I created an “issue” on github and linked to this post. https://github.com/expo/expo/issues/2087
Hi all, thanks for your patience?
Could you please follow the instructions I’ve put in https://github.com/expo/expo/issues/2087#issuecomment-414996822 and see if it helps to resolve the issue?
1 Like
system
Closed
September 6, 2018, 11:15am
13
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.