User Tools

Site Tools


plugins:apk_builder

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

plugins:apk_builder [2015/08/20 20:16]
119.30.38.227 [The APKBuilder plugin]
plugins:apk_builder [2017/01/16 14:18]
Line 1: Line 1:
- 
- 
-//Init variables.  
-var sum = "";  
- 
-//Called when application is started.  
-function OnStart()  
- 
-    //Create a layout with objects vertically centered.  
-    layMain = app.CreateLayout( "linear", "FillXY" );      
- 
-    //Create array to hold number buttons.  
-    keys = [ 7,8,9,"/", 4,5,6,"*", 1,2,3,"-", 0,".","C","+" ];  
-      
-    //Create text control for displaying sum.  
-    txtSum = app.CreateText( "", 0.8, 0.1 );  
-    txtSum.SetTextSize( 42 );  
-    txtSum.SetBackColor( "#ff222222" );  
-    txtSum.SetMargins( 0, 0.1, 0, 0.05 );  
-    layMain.AddChild( txtSum );  
-      
-    //Create first row of buttons.  
-    lay1st = app.CreateLayout( "linear", "Horizontal" );      
-    for( i=0; i<4; i++ ) AddButton( lay1st, keys[i] );  
-    layMain.AddChild( lay1st );  
-      
-    //Create second row of buttons.  
-    lay2nd = app.CreateLayout( "linear", "Horizontal" );      
-    for( i=4; i<8; i++ ) AddButton( lay2nd, keys[i] );  
-    layMain.AddChild( lay2nd );  
-      
-    //Create third row of buttons.  
-    lay3rd = app.CreateLayout( "linear", "Horizontal" );      
-    for( i=8; i<12; i++ ) AddButton( lay3rd, keys[i] );  
-    layMain.AddChild( lay3rd );  
-      
-    //Create fourth row of buttons.  
-    lay4th = app.CreateLayout( "linear", "Horizontal" );      
-    for( i=12; i<16; i++ ) AddButton( lay4th, keys[i] );  
-    layMain.AddChild( lay4th );  
-      
-    //Create fifth row of buttons.  
-    lay5th = app.CreateLayout( "linear", "Horizontal" );      
-    AddButton( lay5th, "=" );  
-    layMain.AddChild( lay5th );  
- 
-    //Add layout to app.      
-    app.AddLayout( layMain );  
- 
- 
-//Add a button to a given layout.  
-function AddButton( lay, name )  
- 
-    if( name=="=" ) w = 0.8; else w=0.2;  
-    btn = app.CreateButton( name, w, 0.1, "Alum" );  
-    btn.SetOnTouch( btns_OnTouch );  
-    lay.AddChild( btn );  
- 
- 
-//Called when user presses number buttons.  
-function btns_OnTouch()  
- 
-    app.Vibrate( "0,100" );  
-      
-    //Get button text.  
-    btn = app.GetLastButton();  
-    var txt = btn.GetText();  
-      
-    //Handle equals button.  
-    if( txt=="=" ) CalcResult();  
-      
-    //Handle clear button.  
-    else if( txt=="C" ) sum = "";  
-      
-    //Handle other buttons.  
-    else sum += txt;  
-      
-    //Update display.  
-    txtSum.SetText( sum );  
- 
- 
-//Calculate sum.  
-function CalcResult()  
- 
-    try {  
-        //Evaluate sum (and catch errors).  
-        sum = eval( sum ).toFixed(2);  
-    }  
-    catch(e) { sum = "Error" }  
- 
- 
-=====Introduction===== 
- 
-The DroidScript ApkBuilder plugin allows you to export your Apps to standard Android Package files (APK files). You can then distribute your Apps to your friends or upload your Apps to Google Play for the whole world to try! 
- 
-=====Usage=====  
- 
-Once the ApkBuilder plugin is downloaded, you can create APK files by long pressing on your App icon in DroidScript and selecting the 'Build APK' option. 
- 
-=====Notes===== 
- 
-It is important to use relative file paths in your JavaScript source code to load images, sounds and external scripts etc, because these files are copied into the APK file as internal assets. Remember the "/sdcard/DroidScript" folder will probably not exist on someone else's mobile device. 
- 
-=====How can you get this plugin?===== 
- 
-The ApkBuilder plugin is **not** free. You have to pay a little money for it. But if you bought it, you can build so much apk files as you want! After each new installation of DroidScript you should **reinstall** (no new buying) the plugin.  
-You can download it over the Plugin-Section within DroidScript. 
- 
-=====First Start===== 
- 
-After the first start of the plugin you must create a **user.keystone** file. You need a password for it. You find this file in your apk folder. Every time you want create a apk file DroidScript ask you for that password in that file. **Save this file on a other save place too!**\\ 
- 
-===Here is a warning from Dave, developer of DroidScript:=== 
-//If you are publishing to Google Play...\\ 
- 
-It is essential that you back up the user.keystore file and use exactly the same keystore file and password every time you update your App on Google Play or else you will have to remove your App and publish it again (losing all your ratings).  You cannot re-create the same keystore file.\\ 
- 
-(There is a warning in DroidScript about this when you create your key and password for the first time)\\ 
- 
-You can find this keystore file in the APKs folder.// 
  
plugins/apk_builder.txt · Last modified: 2017/01/16 14:18 (external edit)