0

I am new to cordova.I want to know how to open phone settings using cordova? I found this

startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); 

But don't understand where to put this.

Gerald Versluis
  • 21,913
  • 5
  • 52
  • 75
  • I know little about cordova but that code is to open Android OS settings. – Kalem Jul 10 '15 at 09:45
  • Okay Kalem.But is there any way to open phone setting from my app?Actually I work on geolocation and I want whenever the device location is off it will show a button called setting.and after clicking the button it will open phone setting.In many app we can see this type of facility. – Rima Chakraborty Jul 11 '15 at 02:41

2 Answers2

0

You are not able to open the Device Settings from inside an application on your own or with your own dialog.

Prior to iOS 5.1 it was possible to open up specific settings with the prefs: link as you can see in a long answer here -> iOS Settings PREFS

Open up the settings is only possible through a real device dialog like deactivated location services or disabling air-plane mode or sth. like that. Since iOS 8 it is possible to open up the settings application. More information can be found here -> Opening Settings Dialog

https://stackoverflow.com/a/23824117/3671726

Community
  • 1
  • 1
Sithys
  • 3,453
  • 6
  • 29
  • 57
  • Sithys thanks for your quick reply.But still not clear.I am using cordova and using that I want to open phone setting.Actually I work on geolocation and I want whenever the android phone location is off it will show a button called setting.and after clicking the button it will open phone setting.In many app we can see this type of facility. – Rima Chakraborty Jul 11 '15 at 02:58
  • Yes, but this is a system behaviour - you can not open the settings via a `prompt`, `alert` or anything else because there will be no command for doing this! – Sithys Jul 13 '15 at 07:36
0

What i mean with my comment is that if you use that code it will only work for Android OS devices.

As @Sithys said for iOS or other plateforms you would need some other kind of call.

If you still want to make this work with Android check https://stackoverflow.com/a/27785992/665823 . As far a i know to make this kind of call you need to create a JavaScript Interface so maybe this tutorial can help you http://devgirl.org/2013/07/17/tutorial-how-to-write-a-phonegap-plugin-for-android/

Community
  • 1
  • 1
Kalem
  • 1,122
  • 12
  • 31