Presentation is loading. Please wait.

Presentation is loading. Please wait.

Phonegap Bridge Configuration file

Similar presentations


Presentation on theme: "Phonegap Bridge Configuration file"— Presentation transcript:

1 Phonegap Bridge Configuration file
CIS 136 Building Mobile Apps

2 Configuration Bridges the Gap between your standard web technologies, and the unique capabilities inherent in your smartphone A platform agnostic XML file that controls many aspects of an app's behavior Defines global and platform-specific options core set of images for each target platform icons and splash screens If you do not specify an icon then the Apache Cordova logo is used Root element of the config file is the <widget>

3 Core components id: Specifies the app's reverse-domain identifier version: Full version number expressed in major/minor/patch notation versioncode: Alternative version for Android xmlns: Namespace for the config.xml document xmlns: gap Namespace prefix name: The app's formal name, as it appears on the device's home screen and within app-store interfaces description: Specifies metadata that may appear within app-store listings author: Specifies contact information that may appear within app-store listings content: The app's starting page in the top-level web assets directory. The default value is index.html

4 Origin policy access: Defines the set of external domains the app is allowed to communicate with. The default “*” allows it to access any server allow-intent: Controls which URLs the app is allowed to ask the system to open. By default, no external URLs are allowed platform: configurations that should only appear in a specific platform

5 Preferences options as pairs of name/value attributes

6 Icons References to icons used in the app

7 Splash Screen

8 Plug-ins add-on code that provides JavaScript interface to native components In Phonegap, there is a minimal set and there are lots of 3rd party plug-ins to choose from, like Paypal Learning how and when to use the plug-in is key Requires writing Javascript/jQuery code

9 Core plug-ins Battery Camera Console Contacts Device Accelerometer
Compass Dialogs File System File Transfer Geolocation Globalization inApp Browser Media Media Capture Network Information Splashscreen Vibration StatusBar

10 Beep, Alert, prompt, confirm
Dialog Plugin Beep, Alert, prompt, confirm

11 Dialog Plugin Phonegap API provides ways to communicate with the user, using same approach as in traditional web design Alert window Prompt window Confirm window The dialog plugin provides access to these native dialog UI elements

12 Dialog Plugin Before accessing native features using the Phonegap API, must ensure that the phonegap container has finished initializing Use event listeners, and listen for when the device is ready

13 Dialog Plugin methods Four methods: navigator.notification.alert
navigator.notification.confirm navigator.notification.prompt navigator.notification.beep

14 Beep method SYNTAX navigator.notification.beep(times);
times: The number of times to repeat the beep. (Number)

15 Alert method – shows and alert dialog box
SYNTAX: navigator.notification.alert(message, alertCallback, [title], [buttonName]) message: Dialog message. (String) alertCallback: Callback to invoke when alert dialog is dismissed. (Function) title: Dialog title. (String) (Optional, defaults to Alert) buttonName: Button name. (String) (Optional, defaults to OK)

16 Confirm method SYNTAX navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels]) •message: Dialog message. (String) •confirmCallback: Callback to invoke with index of button pressed (1, 2, or 3) or when the dialog is dismissed without a button press (0). (Function) •title: Dialog title. (String) (Optional, defaults to Confirm) •buttonLabels: Array of strings specifying button labels. (Array) (Optional, defaults to [OK,Cancel])

17 Confirm Method confirmCallback (confirmDialog) executes when the user presses one of the buttons in the confirmation dialog box

18 Prompt method SYNTAX navigator.notification.prompt(message, promptCallback, [title], [buttonLabels], [defaultText]) message: Dialog message. (String) promptCallback: Callback to invoke with index of button pressed (1, 2, or 3) or when the dialog is dismissed without a button press (0). (Function) title: Dialog title (String) (Optional, defaults to Prompt) buttonLabels: Array of strings specifying button labels (Array) (Optional, defaults to ["OK","Cancel"]) defaultText: Default textbox input value (String) (Optional, Default: empty string)

19 Prompt Method The promptCallback (promptResponse) executes when the user presses one of the buttons in the prompt dialog box. The results object passed to the callback contains the following properties: buttonIndex: The index of the pressed button. (Number) Note that the index uses one-based indexing, so the value is 1, 2, 3, etc. input: The text entered in the prompt dialog box. (String)


Download ppt "Phonegap Bridge Configuration file"

Similar presentations


Ads by Google