0

I have an app installed on my Android device that lets you access the settings from the App Info page:

android screen-shot

How can I achieve that behavior?

Ariel Malka
  • 15,697
  • 6
  • 31
  • 33
  • Does this answer your question? [How can I start android application info screen programmatically?](https://stackoverflow.com/questions/4421527/how-can-i-start-android-application-info-screen-programmatically) – Annas Surdyanto Jul 26 '23 at 15:40
  • @AnnasSurdyanto Thanks, but I think it's not helping. It's a 12+ year old question. Nowadays, in order to open the App Info, you just do it via a long-press on the app icon. Anyways, my goal is to open the Settings activity of my app. – Ariel Malka Jul 26 '23 at 15:47
  • Try implementing an activity that has an `` for https://developer.android.com/reference/kotlin/android/content/Intent?hl=en#action_application_preferences. – CommonsWare Jul 26 '23 at 16:21
  • @CommonsWare I followed your answer from https://stackoverflow.com/questions/41105494/how-can-i-create-a-settings-button-in-androids-app-info-page, but on my Android 12 device, I can't see any settings button in the App Info page. – Ariel Malka Jul 26 '23 at 18:03
  • There is no requirement for any particular device manufacturer to honor that `Intent` action. If AR Zone is a Samsung app, bear in mind that a Samsung app running on a Samsung phone can do things that may not be available to ordinary apps. If you see an ordinary third-party app that has the behavior you seek, and yours does not, there are tools you can use to examine that app's manifest, to see if you see what you might be missing. – CommonsWare Jul 26 '23 at 18:43
  • @CommonsWare I see. So there is no official mechanism on Android for accessing an app's Settings activity without opening the app? – Ariel Malka Jul 26 '23 at 20:53
  • There is no *mandatory* mechanism. Device manufacturers can do what they want. AFAIK, the one I pointed to is the only general-purpose option, and if a manufacturer chooses not to support that on their Settings app, that is their decision. – CommonsWare Jul 26 '23 at 21:10

2 Answers2

0

I am sorry to reply to your comment here due to insufficient points. I know that the duplication reference is too old. However, I have used it and it works fine in Android 12 with the following code adapted from the reference:

 val intent = Intent()
    val packageName = requireContext().packageName
    intent.action = Settings.ACTION_APPLICATION_DETAILS_SETTINGS
    val uri = Uri.fromParts("package", packageName, null)
    intent.data = uri
    requireContext().startActivity(intent)

If you want to test the code above, you can run this project.

  • I think there is a misunderstanding: I'm not trying to open the App Info screen programmatically. I just want a button in my App Info screen that opens my Settings activity. – Ariel Malka Jul 26 '23 at 18:00
  • I have just realized your intention. I do apologize for this misunderstanding. I will get back here once I find the answer. – Annas Surdyanto Jul 26 '23 at 18:52
0

I ended up using Android app shortcuts to launch my own Settings activity.

Official documentation here.

Ariel Malka
  • 15,697
  • 6
  • 31
  • 33