installation of phonegap system Cordova:
-----------------------------step 1-------------------------------------------------------------------------
(1)install node from http://nodejs.org
to test : node --version
and
Install Git
http://git-scm.com.
---------------------------end of step 1----------------------------------------------------------
--------------------------step 2-----------------------------------------------------------------
(2)install cordova step by step :
(a)open command prompt:
then type following:
npm install -g cordova
(b)after installation test :
cordova --version
-------------------------end of step2 -------------------------------------------------------------------------------
--------------------------setp 3--------------------------------------------------------------------------------------------
(3)install ant:
(a)Go to http://ant.apache.org/bindownload.cgi
(b) & download zip file for Ant & extract zip file into
C:\Program Files\ANT\apache-ant-1.8.4
(c) to test :
ant -version
-----------------------------------end of step3-----------------------------------------------------------------------------
----------------------------------SEt varaible names step 4------------------------------------------------------------------------------
SEt variable nameS STEP BY STEP:
(a)GO TO FOLLOWING PATH :
FIRST OPEN CONTROL PANEL
(b) then go to Control Panel\All Control Panel Items\System
And follow the following gudiance to set variable name:
(a)variable name:ANT_HOME
variable value:C:\Program Files\ant\bin\ant.bat
(b)variable name:
ANDROID_HOME
variable value:D:\om\Android development detials\android-sdk-windows
(c)variable name:JAVA_HOME
variable value:
C:\Program Files (x86)\Java\jdk1.8.0_40
(d)variable name:PATH
variable value:D:\om\Android development detials\android-sdk-windows;C:\USERS\OM\AppData\Roaming\npm;C:\Program Files\ant\bin
-------------------------------------------varibale setting done--------------------------------------------------------------------------------------------------------
-------------step 5---------installation of eclipse & Android Sdk for windows----------------------
(a)install eclispe for java development & android development from "https://eclipse.org"
(b)install Android Sdk for Windows from http://developer.android.com/sdk/index.html#top
there are other download option on this link to download android sdk =http://developer.android.com/sdk/index.html#Other
--------------------------------------------------end of eclispe installtion & Android sdk installation--------------------------------------------------------------------
--------------------------step6----Creating my first apps------------------using html-css-javascript---------------------------------------------------------------------
open command prompt:
(1) type following command which will create a folder under c:/ drive myfirstapp:
cordova create myfirstapp com.example.myfirstapp myfirstaap
(2) To add platform to cordova type following command to add android platform :
cordova platform add android
(a)then open your folder myfirstapp :
(i)go to path C:\myfirstapp\www\index.html
(ii)then open index.html file :
& replace all code by following code of html:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
div#test{ border:#000 1px solid; padding:10px 40px 40px 40px; }
</style>
<script language='JavaScript' type='text/JavaScript'>
var tenth = '';
function ninth() {
if (document.all) {
(tenth);
alert("Right Click Disable");
return false;
}
}
function twelfth(e) {
if (document.layers || (document.getElementById && !document.all)) {
if (e.which == 2 || e.which == 3) {
(tenth);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = twelfth;
} else {
document.onmouseup = twelfth;
document.oncontextmenu = ninth;
}
document.oncontextmenu = new Function('alert("Right Click Disable"); return false')
</script>
<script>
var pos = 0, test, test_status, question, choice, choices, chA, chB, chC, correct = 0;
var questions = [
[ "What is 10 + 4?", "12", "14", "16", "B" ],
[ "What is 20 - 9?", "7", "13", "11", "C" ],
[ "What is 7 x 3?", "21", "24", "25", "A" ],
[ "What is 8 / 2?", "10", "2", "4", "C" ],
[ "What is 4 / 2?", "10", "2", "4", "B" ],
[ "What is full form of html?", "htypertext markup language", "2", "4", "A" ]
];
function _(x){
return document.getElementById(x);
}
function renderQuestion(){
test = _("test");
if(pos >= questions.length){
test.innerHTML = "<h2>You got "+correct+" of "+questions.length+" questions correct</h2>";
_("test_status").innerHTML = "Test Completed";
pos = 0;
correct = 0;
return false;
}
_("test_status").innerHTML = "Question "+(pos+1)+" of "+questions.length;
question = questions[pos][0];
chA = questions[pos][1];
chB = questions[pos][2];
chC = questions[pos][3];
test.innerHTML = "<h3>"+question+"</h3>";
test.innerHTML += "<input type='radio' name='choices' value='A'> "+chA+"<br>";
test.innerHTML += "<input type='radio' name='choices' value='B'> "+chB+"<br>";
test.innerHTML += "<input type='radio' name='choices' value='C'> "+chC+"<br><br>";
test.innerHTML += "<button onclick='checkAnswer()'>Submit Answer</button>";
}
function checkAnswer(){
choices = document.getElementsByName("choices");
for(var i=0; i<choices.length; i++){
if(choices[i].checked){
choice = choices[i].value;
}
}
if(choice == questions[pos][4]){
correct++;
}
pos++;
renderQuestion();
}
window.addEventListener("load", renderQuestion, false);
</script>
</head>
<body>
<h2 id="test_status"></h2>
<div id="test"></div>
</body>
</html>
& save it
Now go for next step:
(3)then build your first app type following command:
cordova build
(4)then run your apps by typing following apps:
cordova emulate android
-----------------------------------end of step 6-------------------------------------------------------------------------------------------------------------- sep 7---------------------------
finally HOW TO RELEASE YOUR APK FILE :use following command :
-----------------------------step 1-------------------------------------------------------------------------
(1)install node from http://nodejs.org
to test : node --version
and
Install Git
http://git-scm.com.
---------------------------end of step 1----------------------------------------------------------
--------------------------step 2-----------------------------------------------------------------
(2)install cordova step by step :
(a)open command prompt:
then type following:
npm install -g cordova
(b)after installation test :
cordova --version
-------------------------end of step2 -------------------------------------------------------------------------------
--------------------------setp 3--------------------------------------------------------------------------------------------
(3)install ant:
(a)Go to http://ant.apache.org/bindownload.cgi
(b) & download zip file for Ant & extract zip file into
C:\Program Files\ANT\apache-ant-1.8.4
(c) to test :
ant -version
-----------------------------------end of step3-----------------------------------------------------------------------------
----------------------------------SEt varaible names step 4------------------------------------------------------------------------------
SEt variable nameS STEP BY STEP:
(a)GO TO FOLLOWING PATH :
FIRST OPEN CONTROL PANEL
(b) then go to Control Panel\All Control Panel Items\System
And follow the following gudiance to set variable name:
(a)variable name:ANT_HOME
variable value:C:\Program Files\ant\bin\ant.bat
(b)variable name:
ANDROID_HOME
variable value:D:\om\Android development detials\android-sdk-windows
(c)variable name:JAVA_HOME
variable value:
C:\Program Files (x86)\Java\jdk1.8.0_40
(d)variable name:PATH
variable value:D:\om\Android development detials\android-sdk-windows;C:\USERS\OM\AppData\Roaming\npm;C:\Program Files\ant\bin
-------------------------------------------varibale setting done--------------------------------------------------------------------------------------------------------
-------------step 5---------installation of eclipse & Android Sdk for windows----------------------
(a)install eclispe for java development & android development from "https://eclipse.org"
(b)install Android Sdk for Windows from http://developer.android.com/sdk/index.html#top
there are other download option on this link to download android sdk =http://developer.android.com/sdk/index.html#Other
--------------------------------------------------end of eclispe installtion & Android sdk installation--------------------------------------------------------------------
--------------------------step6----Creating my first apps------------------using html-css-javascript---------------------------------------------------------------------
open command prompt:
(1) type following command which will create a folder under c:/ drive myfirstapp:
cordova create myfirstapp com.example.myfirstapp myfirstaap
(2) To add platform to cordova type following command to add android platform :
cordova platform add android
(a)then open your folder myfirstapp :
(i)go to path C:\myfirstapp\www\index.html
(ii)then open index.html file :
& replace all code by following code of html:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
div#test{ border:#000 1px solid; padding:10px 40px 40px 40px; }
</style>
<script language='JavaScript' type='text/JavaScript'>
var tenth = '';
function ninth() {
if (document.all) {
(tenth);
alert("Right Click Disable");
return false;
}
}
function twelfth(e) {
if (document.layers || (document.getElementById && !document.all)) {
if (e.which == 2 || e.which == 3) {
(tenth);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = twelfth;
} else {
document.onmouseup = twelfth;
document.oncontextmenu = ninth;
}
document.oncontextmenu = new Function('alert("Right Click Disable"); return false')
</script>
<script>
var pos = 0, test, test_status, question, choice, choices, chA, chB, chC, correct = 0;
var questions = [
[ "What is 10 + 4?", "12", "14", "16", "B" ],
[ "What is 20 - 9?", "7", "13", "11", "C" ],
[ "What is 7 x 3?", "21", "24", "25", "A" ],
[ "What is 8 / 2?", "10", "2", "4", "C" ],
[ "What is 4 / 2?", "10", "2", "4", "B" ],
[ "What is full form of html?", "htypertext markup language", "2", "4", "A" ]
];
function _(x){
return document.getElementById(x);
}
function renderQuestion(){
test = _("test");
if(pos >= questions.length){
test.innerHTML = "<h2>You got "+correct+" of "+questions.length+" questions correct</h2>";
_("test_status").innerHTML = "Test Completed";
pos = 0;
correct = 0;
return false;
}
_("test_status").innerHTML = "Question "+(pos+1)+" of "+questions.length;
question = questions[pos][0];
chA = questions[pos][1];
chB = questions[pos][2];
chC = questions[pos][3];
test.innerHTML = "<h3>"+question+"</h3>";
test.innerHTML += "<input type='radio' name='choices' value='A'> "+chA+"<br>";
test.innerHTML += "<input type='radio' name='choices' value='B'> "+chB+"<br>";
test.innerHTML += "<input type='radio' name='choices' value='C'> "+chC+"<br><br>";
test.innerHTML += "<button onclick='checkAnswer()'>Submit Answer</button>";
}
function checkAnswer(){
choices = document.getElementsByName("choices");
for(var i=0; i<choices.length; i++){
if(choices[i].checked){
choice = choices[i].value;
}
}
if(choice == questions[pos][4]){
correct++;
}
pos++;
renderQuestion();
}
window.addEventListener("load", renderQuestion, false);
</script>
</head>
<body>
<h2 id="test_status"></h2>
<div id="test"></div>
</body>
</html>
& save it
Now go for next step:
(3)then build your first app type following command:
cordova build
(4)then run your apps by typing following apps:
cordova emulate android
-----------------------------------end of step 6-------------------------------------------------------------------------------------------------------------- sep 7---------------------------
finally HOW TO RELEASE YOUR APK FILE :use following command :
No comments:
Post a Comment