0

From Web application that consists of only web pages. In that, I need to open android settings activity. How to invoke it?

Marsh K
  • 151
  • 1
  • 2
  • 9

2 Answers2

2

You cannot invoke Android Settings from web unless you have app which handle custom uri scheme.

to invoke application in android from Webpage there needs to be app which handles call from particular Uri Scheme in android app on android device.

you can create android app which handle custom uri scheme like below for activity to be invoked when url is visited in browser.

<activity android:name=".MyUriActivity">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="myapp" android:host="path" />
    </intent-filter>
</activity>

myapp://opensettings

if application is exist on android device which handle above uri scheme then you can call setting dialog from your android app after user redirect to myapp://opensettings url in browser.

Kirtan
  • 1,782
  • 1
  • 13
  • 35
  • In "myapp://opensettings" whats belong to opensettings?? – Marsh K Aug 20 '15 at 13:30
  • its just example of custom uri you can write anything like myapp://xyz when you invoke this url in android inside browser the app with MyUriActivity here in example will invoke with value myapp://xyz so that you can handle case inside android app to open settings dialog. – Kirtan Aug 21 '15 at 02:26
1

Based on:

I feel like it should be possible with something like

<a href="intent:#Intent;action=android.settings.SETTINGS;end;">open settings</a>

but it does not work, for some reason I can't figure out.

I wanted to post the same question with my failing solution and ask what was wrong with my solution.
I guess I'll just post an wrong answer instead.

edit: here's another reference:
Open android application from a web page

edit2: I did some more digging and I think I found out what's wrong with this solution:
Opening Location Settings Activity from Chrome on Android
and its answer:
https://stackoverflow.com/a/46175726/10028142