ShowTable of Contents
It is assumed that you have set up your environment with Worklight + WEF prior to using these samples. If not refer Getting Started and Enabling Worklight Support
for more details about configuring your environment. Check the references section for more links to Worklight, WEF documentation. Worklight v6.0 and WEF 126.96.36.199 are used for writing this document.
Worklight Enablement builder is included in Multichannel Feature Pack for IBM Web Experience Factory 188.8.131.52
Setting up samples
The WLEnable.zip file attached to this article includes two samples. You need to create a Hybrid app with IBM Worklight and install it on your device. Step by step guide to create hybrid worklight project referencing WEF samples is in above mentioned 'Getting Started and Enabling Worklight Support' article.
Setup for Camera builder samples (as mentioned in 'Getting Started and Enabling Worklight Support' article) and Worklight Enable builder samples differs little bit, here are few updated instructions to follow. Section and step numbers mentioned below are from 'Getting Started and Enabling Worklight Support' article.
1. Section  Creating a WEF project --> Step d -->
changes are needed to WEF_project \ WebContent \ WEB-INF \ config \ override.properties
file as we are not uploading any image files.
2. Section  Creating a hybrid shell that points to your WEF server application --> Step a -->
You will only need to add following user permissions to Worklight_project \ apps \ Your_App \ android \ native \ AndroidManifest.xml
<!--For Device API -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!--For Notification API -->
<uses-permission android:name="android.permission.VIBRATE" />
<!--For Media API -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
3. Section  Creating a hybrid shell that points to your WEF server application --> Step b -->
changes are needed to Worklight_project \ apps \ Your_App \ android \ native \ src \ com \ Your_App \ Your_App.java
Instead you will be modifying Worklight_project \ apps \ Your_App \ application-descriptor.xml
. Change the
tag to refer to your WEF model URL.
Button names are pretty self explanatory. Device info button shows device model, platform, version, cordova version. Vibrate, Beep, Alert and Confirm buttons make use of Notification API to give respective visual or tactile notifications.
For simplicity the playing and recording is limited to 10 sec each but you can stop it anytime in between with the stop buttons.
Worklight Enable builder Doc
IBM Worklight v6.0 Getting Started
Cordova API Reference Doc