Saturday, 28 June 2014

PhoneGap Cordova tutorial for beginners

Android with PhoneGap in Eclipse


       You need the Android SDK installed on your computer to build an Android version of your application using the steps below.
To build the project in the workshop/platforms/android folder and run it on an Android device connected to your computer using a USB cable, type:
cordova run android
To build the project in the workshop/platforms/android folder and run it in the Android emulator, type:
cordova emulate android

Setting Up the Workshop Files

  1. Download the assets for the workshop here or clone this repository
  2. Unzip the file anywhere on your file system.
  3. Delete the contents of your project’s workshop/www folder with the exception of the config.xml file.
  4. Copy the contents of cordova-tutorial-master/www into your project’s workshop/www folder.
  5. Build and test your application: If you have a Mobile SDK installed on your system, repeat the steps in Part 2 above. If you don’t, simply open index.html in a browser on your computer.
  6. Type a few characters in the search box to search employees by name. Clicking an employee link doesn't produce any result at this time.
 The following <uses-permission> XML nodes and paste them as children of the root <manifest> node in the AndroidManifest.xml file: 
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.RECEIVE_SMS" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.RECORD_VIDEO"/> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.BROADCAST_STICKY" /> The <uses-permission>
XML values identify the features that you want to be enabled for your application. The lines above enable all permissions required for all features of PhoneGap to function. After you have built your application, you may want to remove any permissions that you are not actually using; this will remove security warnings during application installation. To read more about Android permissions and the <uses-permission> element, visit the Android developer topic on the uses-permission element.. After you have configured application permissions, you need to modify the existing <activity> node. 
 Locate the <activity> node, which is a child of the <application> XML node. Add the following attribute to the <activity> node:
 android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale">
Thank you....

Sunday, 22 June 2014

How to config Phone Gap Application in Android

Phone Gap for Android on a Windows machine.

Download and install PhoneGap

Download link-  http://phonegap.com/install/
Download Phone Gap Latest version and install in eclipse

Steps:
Launch Eclipse, and then, from the File menu, select New -> Android Project.
In the root directory of the project, create two new directories:
/libs
/assets/www
Copy phonegap.js from your PhoneGap download earlier to /assets/www.
Copy phonegap.jar from your PhoneGap download earlier to /libs.
Now, you must make the following adjustments to the project’s main Java file found in the
src folder in Eclipse
Change the class extend from Activity to DroidGap.
Replace the setContentView() line with
super.loadUrl(“file:///android_asset/www/index.html”);.
Add import com.phonegap.*;.

Create your own Phone Gap Android Application..

Thank You........