Hi all...Now am going to show you,How to create your Cross Plot-form (i.e Phone-gap) app with Android.
Phonegap : It is Framework. Phone Gap is an open source platform that allows you to create cross-platform mobile applications with HTML, JavaScript, and CSS. Build app once & run Any where ....
Phonegap : It is Framework. Phone Gap is an open source platform that allows you to create cross-platform mobile applications with HTML, JavaScript, and CSS. Build app once & run Any where ....
Now am going to show you step by step please follow the steps....
First we need to Download Phonegap From Official Website.You Will get a zip file ,Unzip it.You
Create New Project: HelloWorldPhonegap :
Click on Next -->
Click on Next -->
Click on Next -->
Click on Next -->
Click on Next -->
Click on Finish-->
Creat a Newfolder in Assets and name it as www .
After Completion of this go to Phone gap Unzip Folder which is downloaded before from Official Website.
Go to android folder copy the (A) cordova-2.1.0.js & (B) cordova-2.1.0.jar and (C) XML Folder and Paste it accordingly which is shown in the fig.Below.
Then go to MainActivity and Extends the DriodGap in Place of Activity.
And replace setContentView(R.layout.activity_main) with
Super.loadUrl("file:///android_asset/www/index.html")
Creat a index.html file and Place it in assets/www folder
Go to Manifest File and Place all the permission which are showned below
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:xlargeScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
<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" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
And then run the app :
Done with Phone gap Sample Hello World....
MainActivity.java :
import org.apache.cordova.DroidGap;
import android.os.Bundle;
public class MainActivity extends DroidGap {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
}
index.html :
<!DOCTYPE html>
<html>
<head>
PhoneGap Hello World
</head><br>
<body bgcolor="WHITE">
<a href="" >Home</a> <br>
<a href="" >ABout</a><br>
<a href="" >Services</a><br>
<a href="" >Careers</a><br>
<a href="" >ContactUs</a><br>
</body><br>
<footer>
@Copy rights apc 2014
</footer>
</html>
Screen Shots :
Source Code : Click here to Download Source Code
Happy Programming...
Cheers....!!!