I am trying to open Device settings on Android using
Linking.openURL('app-settings:');
This works perfectly on iOS but on Android it says No Activity found to handle intent.
I am trying to open Device settings on Android using
Linking.openURL('app-settings:');
This works perfectly on iOS but on Android it says No Activity found to handle intent.
I followed the instructions on the page for intent-launcher. I passed, ACTION_APP_NOTIFICATION_SETTINGS
to startActivityAsync. I got a message saying,
The app wasn’t found the in the list of apps.
It looks like the api also requires a map with the key: EXTRA_APP_PACKAGE
to be passed in. I tried the name of the app. Do you know what value it would be expecting? I don’t have a standalone app.
Thanks.
Hey,
Were you able to figure out how to pass the extra app package to this API? I am stuck with the same issue.
Also, do you know how to open camera & camera roll permission settings. Can’t seem to find those in the list of the intents defined.
Thanks
Hi,
I was able to make this work by using the following snippet:
IntentLauncherAndroid.startActivityAsync(
IntentLauncherAndroid.ACTION_APP_NOTIFICATION_SETTINGS,
{
"android.provider.extra.APP_PACKAGE": "paste here your application's package name"
}
);
Hope it helps,
cheers!
Hey Sergio,
This works in which android API? ( I tested on API 26 MOTO G 6 and worked)
After a lot of trial and error I managed to get it to work using the third param.
import { IntentLauncherAndroid, Constants } from 'expo'
IntentLauncherAndroid.startActivityAsync(
IntentLauncherAndroid.ACTION_APPLICATION_DETAILS_SETTINGS,
{},
'package:' + Constants.manifest.android.package
)
Now it’s slighlty different
import * as IntentLauncher from "expo-intent-launcher";
import Constants from "expo-constants";
const pkg = Constants.manifest.releaseChannel
? Constants.manifest.android.package // When published, considered as using standalone build
: "host.exp.exponent"; // In expo client mode
IntentLauncherAndroid.startActivityAsync(
IntentLauncherAndroid.ACTION_APPLICATION_DETAILS_SETTINGS,
{ data: 'package:' + pkg },
)
Thanks @bodolsog, your solution is working and unfortunately not documented anywhere. Finding how to make this work was a struggle !
Saved my day!!
Hi,
IntentLauncher.ACTION_APPLICATION_DETAILS_SETTINGS
open the app general settings, but how to open the app Notifications settings screen?
IntentLauncher.ACTION_APP_NOTIFICATION_SETTINGS
it doesn’t work on the SDK 33 and 34. In the SDK 32, yes.
Has anyone found it too?
Regards,
Thank you, it helped me to open app details settings.
But i want to go deeper settings like opening app permissions settings…how can i open expo app location permission settings from app?
That’s the answer. Can be closed.
Thanks!!
So it looks like there is different ways based on different API level? So is the correct way to do a test on Device.platformApiLevel
and then are these the right techniques for the levels? It would be nice if we can put in this topic one function that works for all api levels, Ill try here, does this look right?
The api levels I used are total guess work, need your help on that.
import * as Device from 'expo-device';
import * as IntentLauncher from 'expo-intent-launcher';
import Constants from 'expo-constants';
function openNotificationSettingsAndroid() {
if (Device.platformApiLevel < 21) {
// https://docs.expo.dev/versions/latest/sdk/intent-launcher/
IntentLauncher.startActivityAsync(
IntentLauncher.ACTION_APP_NOTIFICATION_SETTINGS
);
} else if (Device.platformApiLevel < 27) {
// https://forums.expo.dev/t/opening-device-settings-on-android-using-linking/2059/6
IntentLauncherAndroid.startActivityAsync(
IntentLauncherAndroid.ACTION_APP_NOTIFICATION_SETTINGS,
{
'android.provider.extra.APP_PACKAGE':
"paste here your application's package name"
}
);
} else if (Device.platformApiLevel <= 32) {
// https://forums.expo.dev/t/opening-device-settings-on-android-using-linking/2059/8
IntentLauncherAndroid.startActivityAsync(
IntentLauncherAndroid.ACTION_APP_NOTIFICATION_SETTINGS,
{},
'package:' + Constants.manifest.android.package
);
} else {
// for Device.platformApiLevel >= 33
// https://forums.expo.dev/t/opening-device-settings-on-android-using-linking/2059/10
const pkg = Constants.manifest.releaseChannel
? Constants.manifest.android.package // When published, considered as using standalone build
: 'host.exp.exponent'; // In expo client mode
IntentLauncherAndroid.startActivityAsync(
IntentLauncherAndroid.ACTION_APP_NOTIFICATION_SETTINGS,
{ data: 'package:' + pkg }
);
}
}