Android Question open phone's settings

trepdas

Active Member
Licensed User
Longtime User
Hi everybody.

I am trying to open the phone's settings with this code :

B4X:
Dim i2 As Intent

        i2.Initialize("", "")
        i2.SetComponent("com.android.settings/.Settings")
        StartActivity(i2)

but I get this in log :

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.settings/com.android.settings.Settings}; have you declared this activity in your AndroidManifest.xml?



when I try to open the status page
B4X:
Dim i2 As Intent

        i2.Initialize("", "")
        'i2.SetComponent("com.android.settings/.Settings")
        i2.SetComponent("com.android.settings/.deviceinfo.Status")
        StartActivity(i2)

it works fine.

is there anything I missed in the manifest?
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

trepdas

Active Member
Licensed User
Longtime User
ok.
changed to
B4X:
i2.SetComponent("com.android.settings/.Settings")

it works only with the android emulator.
when I try galaxy s4 -
still doesn't work.
same error

looks like it prints twice the "com.android.settings" in the log...

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.settings/com.android.settings.ACTION_SETTINGS}; have you declared this activity in your AndroidManifest.xml?
 
Last edited:
Upvote 0

trepdas

Active Member
Licensed User
Longtime User
Ok. Tried it. didn't work.

the only working code was through the emulator only and with
B4X:
i2.SetComponent("com.android.settings/.Settings")

when i TRY THIS :


B4X:
Dim i3 As Intent
        i3.Initialize("com.android.Settings.ACTION_SETTINGS", "")
        StartActivity(i3)

doesn't work both in the emulator and in the galaxy s4.
log :

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.android.Settings.ACTION_SETTINGS flg=0x20000 }
 
Last edited:
Upvote 0
Top