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
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.
Your Answer
Think you can help? Login to answer this question!