USING CORDOVA OR PhoneGap
(Setup for Eclipse Android Package Environment - if installed please ignore)
Set Java Environment Variables
Start > My Computer (right click)> Properties> Advance System Settings
On System Properties window Select Advance Tab
Click Environment Variables
In System Variable click New
Variable Name: ANDROID_HOME
Variable Value: D:\All Proj\Android Activity\adt-bundle-windows-x86-20130917\sdk (set your path)
In System variable Open path variable and append in variable value ;%ANDROID_HOME%\tools
In System Variable click New ( Download latest version of Apache .)
Variable Name: ANT_HOME
Variable Value: C:\Program Files\ANT\apache-ant-1.9.3 (set your path)
In System variable Open path variable and append in variable value ;%ANT_HOME%\bin
In System Variable click New ( Download latest version of java jdk.)
Variable Name: JAVA_HOME
Variable Value: C:\Program Files\Java\jdk1.7.0_45 (set your path)
In System variable Open path variable and append in variable value ;%JAVA_HOME%\bin
Install the cordova module using npm utility of Node.js. The cordova module will automatically be downloaded by the npm utility.
(Commands for Installation :- Start > Run > “cmd” )// to open command prompt
on Mac:
sudo npm install -g cordova
on Windows:
C:\>npm install -g cordova
Create New App ( Move to your folder path in cmd then follow below steps. )
>cordova create hello com.example.hello HelloWorld// Folder bundleID AppName
>cd hello
>cordova platform add ios //For Mac
>cordova platform add android //For Windows
>cordova platforms ls//For Mac -Folder view
>cordova build//For Windows
>cordova build ios //For Mac
>cordova run android //For Windows( Please refer below section -- Get the device recognized by your system)
Plugins- if required
Basic device information (Device API):
cordova plugin add org.apache.cordova.device
Network Connection and Battery Events:
cordova plugin add org.apache.cordova.network-information
cordova plugin add org.apache.cordova.battery-status
Accelerometer, Compass, and Geolocation:
cordova plugin add org.apache.cordova.device-motion
cordova plugin add org.apache.cordova.device-orientation
cordova plugin add org.apache.cordova.geolocation
Camera, Media playback and Capture:
cordova plugin add org.apache.cordova.camera
cordova plugin add org.apache.cordova.media-capture
cordova plugin add org.apache.cordova.media
Access files on device or network (File API):
cordova plugin add org.apache.cordova.file
cordova plugin add org.apache.cordova.file-transfer
Notification via dialog box or vibration:
cordova plugin add org.apache.cordova.dialogs
cordova plugin add org.apache.cordova.vibration
Contacts:
cordova plugin add org.apache.cordova.contacts
Globalization:
cordova plugin add org.apache.cordova.globalization
Splashscreen:
cordova plugin add org.apache.cordova.splashscreen
Open new browser windows (InAppBrowser):
cordova plugin add org.apache.cordova.inappbrowser
Debug console:
cordova plugin add org.apache.cordova.console
To remove plugins
cordova plugin rm Plugin-Name
cordova plugin rm org.apache.cordova.console
Open your project
Start Eclipse select your workspace
Select File>New > New Project window will get open
Select Android Folder and then select “Android Project from Existing Code”
From Import Projects Window > Select Your Project (One which you created by cmd)
Click Select All button
Click Finish.
Note: Select your folder and refresh every time you open Eclipse or fires cordova build command
Get the device recognized by your system
This can be tricky, especially under Windows based systems where drivers tend to be a problem. Also, your device may come with additional information or specific drivers from the manufacturer.
For Windows: If the Android device is automatically recognized by the system you still might need to update the drivers with the ones that came with the Android SDK. This is done through the Windows Device Manager. —>If the device is not recognized automatically use the drivers from the Android SDK, or any specific drivers provided by the manufacturer. —>Additional info can be found here: USB Drivers for Windows
For Mac: If you’re developing on Mac OSX then no additional drivers are usually required.
Note: Don’t forget to turn on “USB Debugging” on your device. Go to Settings -> Developer options, then enable USB debugging. As of Android Jelly Bean 4.2 the Developer options are hidden by default. To enable them tap on Settings -> About Phone -> Build Version multiple times. Then you will be able to access the Settings -> Developer options.
How to Export Apk file
Right Click on Folder (ie. Your Project) select Export
From Export Window select Android Folder > Export Android Application click Next
Select Project (by default its selected) click Next
Key Selection >
Create New keystroke (For Fist Time Every Project)
Select Location To save Key File (Note: Save properly to use in next export)
type password and confirm password (remember for the next time)
Use Existing Key Stroke
Select previous selected key
Enter password
Key alias Selection
Create New Key >Next.
Use Existing Key > select previous alias name enter password
Fill the form use same password set validity more than 25 years
Destination/Key Certificate window browse and type your Application name with .apk extention ie abc.apk
Click Finish
0 comments: