Opening Device Settings on Android using Linking

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.

1 Like

https://docs.expo.io/versions/v19.0.0/sdk/intent-launcher.html

1 Like

Thanks so much @notbrent

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!

1 Like

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
)
2 Likes

@alastairtaft Surprisingly, your solution works! Thank you so much!

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 },
)
2 Likes

Thanks @bodolsog, your solution is working and unfortunately not documented anywhere. Finding how to make this work was a struggle !