2

Is there any code that I can insert in the ActionListener of a Codename One Button to open the app settings on iPhone and on Android?

I saw something similar in other apps, for example to help the user to manually change the app permissions. In my case, I'd like to easily open the app settings to inspect the amount of total storage taken by the app (as suggested in https://stackoverflow.com/a/53992872/2670744) and other infos provided by Android and iOS.

Francesco Galgani
  • 6,137
  • 3
  • 20
  • 23

1 Answers1

1

I haven't tried this but execute("app-settings:") (from Display or CN) might work. If not you will need to use native code, specifically:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];

As mentioned here: How to open settings from my iPad application (Objective-C)

Shai Almog
  • 51,749
  • 5
  • 35
  • 65
  • Thank you. For completeness: `execute("app-settings:")` works on iOS only. On Android, I needed to create a native interface, that I shared here: https://gist.github.com/jsfan3/3397f1cf7853532ddc9c56a09aae8b3b – Francesco Galgani Jan 02 '19 at 23:52
  • Sorry I missed the point where you asked about Android. I'm pretty sure there is an execute string we can use to launch that too – Shai Almog Jan 03 '19 at 03:18
  • I tried to search the String "app-settings" in the Codename One sources, but I didn't find it. So that feature is not implemented by Codename One, but is it implemented by the operating system (iOS in this case)? I'm interested in a list of these Strings because if they exist then they can be useful, however I didn't find documentation. – Francesco Galgani Jan 03 '19 at 09:34
  • 1
    Just google iphone url schemes. This is the current top result: https://ios.gadgethacks.com/news/always-updated-list-ios-app-url-scheme-names-0184033/ I wrote about this a while back and back then there was a different top result. You can also expose your own app using a similar URL scheme of your own – Shai Almog Jan 04 '19 at 03:22