how to display the settings button in an "please turn internet on" dialog on iPhone

You must Login before you can answer or comment on any questions.

How can I open the settings when the "settings" button is clicked on iPhone. This is common when you access apps that require intent but there is no internet available. I know how to create the dialog but I don't know how to open the iPhone settings from my app directly

— asked 9 months ago by Ryan popa
0 Comments

1 Answer

Follow these steps or you can refer this link for more info.

Step1:In the project root folder (same folder where tiapp.xml is located), create a folder named platform. Within it, create an iphone folder. Within it, create a folder called Settings. Using Studio or another text editor, create a new text file in that folder and paste in the XML code shown below. For now, save the file as Root.txt.

Step2:Alternatively, copy the platform/iphone folder from the KitchenSink example app (SDK1.8 version or newer) to your app's root folder. Then modify the contents of those files. Skip steps 3 & 4 if you choose this technique.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>StringsTable</key>
    <string>Root</string>
    <key>PreferenceSpecifiers</key>
    <array>
        <dict>
            <key>Type</key>
            <string>PSGroupSpecifier</string>
            <key>Title</key>
            <string>Lab360</string>
        </dict>
        <dict>
            <key>Type</key>
            <string>PSToggleSwitchSpecifier</string>
            <key>Title</key>
            <string>Image on right</string>
            <key>Key</key>
            <string>rtl_preference</string>
            <key>DefaultValue</key>
            <false/>
        </dict>
    </array>
</dict>
</plist>
Step 3: Using Finder or Terminal, rename the Root.txt file to Root.plist. If you use Finder, you'll be prompted to confirm changing the extension. The file needs to be named with the .plist extension, which is the Apple proprietary XML format for properties files.

Step 4: Rename the Settings folder to Settings.bundle. Again, you might be prompted to confirm that you want to add the .bundle extension. This is a proprietary extension for bundle type directories. The contents will become hidden once you rename the file.

Step 5: In Studio, open app.js and observe the app-level event that is fired. You'll need to add a listener for this event, which will update the position of an image and a view.

Step 6: Open ui.js. Within the setLayout() function, add the code that will set the left and right positions for the fugitiveImage and vitalsView elements. Code comments tell you the values for those settings. Which get implemented should be based on the value of the app property, as set in Settings.

Step 7: Add the event listener where indicated that will call setLayout() when the app resumes from the background state.

Step 8: Build the app for the simulator. The picture should be on the left and text (within the view) on the right. Return to the Springboard. In Settings, set the "Image on right" option to On. Open the Lab 360 app again. The picture should be on the right with vitals to the left.

— answered 9 months ago by Ashish Nigam
answer permalink
3 Comments
  • although this is a wonderful explanation, it doesn't answer the question.

    the question is how to have the app open the device's settings window programatically

    — commented 9 months ago by Aaron Saunders

  • Hi, Aaron you put good point which i missed when i answered this question, so to answer remaining thing is::

    1: Earlier version of iOS(i mean including iOS 5) there was a way to do this.
       way to do in Titanium is Titanium.Platform.openURL(pref://);
    2: To open a specific section of settings App you can do things like
     
    For Airplane mode: prefs:root=AIRPLANE_MODE
    For Bluetooth: prefs:root=General&path=Bluetooth
    For Brightness: prefs:root=Brightness
    For  Location services: prefs:root=LOCATION_SERVICES
    For Location services (System services): prefs:root=LOCATION_SERVICES_Systemservices
    For Hotspots: prefs:root=Hotspot
    For WLAN: prefs:root=WIFI
    For UMTS-Settings: prefs:root=General&path=Network
    For Mobile data: prefs:root=General&path=USAGE/CELLULAR_USAGE
    For VPN: prefs:root=General&path=Network/VPN
    For Sound: prefs:root=Sounds
    For Rigntone: prefs:root=Sounds&path=Ringtone
    For Siri speech settings: prefs:root=General&path=Assistant
     
    **But Now from iOS version 5.1 and Above Apple has restricted that and they don't work anymore.**
    so This information might not help here right now, which i missed to put.

    Apple has stated that this wasn't a public API, and is no longer supported. There is a bug filed on this issue, number 11253669.

    — commented 9 months ago by Ashish Nigam

  • Anyone can try in iOS 5 simulator but not in iOS 5.1 and above.

    — commented 9 months ago by Ashish Nigam

Your Answer

Think you can help? Login to answer this question!