User Tools

Site Tools


plugins:apk_builder

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
plugins:apk_builder [2015/06/30 22:25]
178.62.6.48 [The APKBuilder plugin]
plugins:apk_builder [2017/01/16 14:18] (current)
Line 1: Line 1:
-<html> +======The APKBuilder plugin======
-<head> +
-    <meta name="viewport" content="width=device-width"> +
-    <script src='file:///android_asset/app.js'></script> +
-</head>     +
-<body> +
-<body bgcolor="black"> +
-<script> +
- +
-//Called when application is started.  +
-function OnStart()  +
-{  +
-    //Create a layout with objects vertically centered.  +
-    lay app.CreateLayout( "linear", "VCenter,FillXY" );      +
- +
-    //Create a button to start demo.  +
-    btn app.CreateButton( "Start", 0.3, 0.1 );  +
-    btn.SetOnTouch( btn_OnTouch );  +
-    lay.AddChild( btn );  +
- +
-    //Add layout to app.     i +
-    app.AddLayout( lay );  +
-}  +
- +
-//Called when user touches our button.  +
-function btn_OnTouch()  +
-{  +
-var destFile "/sdcard/test.wav"  +
-var timer 0;  +
-    //Create global variables.  +
- +
-    //Create a layout with objects vertically centered.  +
-    lay app.CreateLayout( "linear", "VCenter,FillXY" );      +
-    lay.SetBackGradient( "#888888", "#555555" );  +
- +
-    //Create a text control to show data log.  +
-    txt app.CreateText( "Level: 0%", 0.8 );  +
-    txt.SetTextColor( "#222222" );  +
-    txt.SetTextShadow( 1, 0,1, "#88ffffff" );  +
-    txt.SetTextSize( 24 );  +
-    lay.AddChild( txt );  +
-      +
-    //Create a 'Start' button.  +
-    btnStart app.CreateButton( "Start", 0.6, -1, "Alum,NoSound" );  +
-    btnStart.SetMargins( 0, 0.05, 0, 0 );  +
-    btnStart.SetOnTouch( btnStart_OnTouch );  +
-    lay.AddChild( btnStart );  +
-      +
-    //Create a 'Pause' button.  +
-    btnPause = app.CreateButton( "Pause", 0.6, -1, "Alum,NoSound" );  +
-    btnPause.SetMargins( 0, 0.05, 0, 0 );  +
-    btnPause.SetOnTouch( btnPause_OnTouch );  +
-    lay.AddChild( btnPause );  +
-      +
-    //Create a 'Stop' button.  +
-    btnStop = app.CreateButton( "Stop", 0.6, -1, "Alum,NoSound" );  +
-    btnStop.SetMargins( 0, 0.05, 0, 0 );  +
-    btnStop.SetOnTouch( btnStop_OnTouch );  +
-    lay.AddChild( btnStop );  +
-      +
-    //Create a 'Play' button.  +
-    btnPlay = app.CreateButton( "Play File", 0.6, -1, "Alum,NoSound" );  +
-    btnPlay.SetMargins( 0, 0.1, 0, 0 );  +
-    btnPlay.SetOnTouch( btnPlay_OnTouch );  +
-    lay.AddChild( btnPlay );  +
-      +
-    //Add layout to app.      +
-    app.AddLayout( lay );  +
-      +
-    //Create Audio Recorder and set dest file.  +
-    rec = app.CreateAudioRecorder();  +
-    rec.SetFile( destFile );  +
-      +
-    //Create media player.  +
-    player = app.CreateMediaPlayer();  +
-    player.SetOnReady( player_OnReady );  +
-      +
-    //Switch off debug so we don't fill the log.  +
-    app.SetDebugEnabled( false );  +
-}  +
- +
-//Called when user touches our 'Start' button.  +
-function btnStart_OnTouch()  +
-{  +
-    rec.Start();  +
-    txt.SetTextColor( "#aa2222" );  +
- +
-    timer = setInterval( GetLevel, 250 );  +
-}  +
- +
-//Called when user touches our 'Pause' button.  +
-function btnPause_OnTouch()  +
-{  +
-    rec.Pause();  +
-    txt.SetTextColor( "#222222" );  +
-}  +
- +
-//Called when user touches our 'Stop' button.  +
-function btnStop_OnTouch()  +
-{  +
-    rec.Stop();  +
-    txt.SetTextColor( "#222222" );  +
-    txt.SetText( "Level: 0%" );  +
-}  +
- +
-//Get the current RMS signal level.  +
-//(A max of about 0.7 for sine waves)  +
-function GetLevel()  +
-{  +
-    var level = rec.GetRMS();  +
-    txt.SetText( "Level: " + Math.round(100*level/0.72) + "%" );  +
-}  +
- +
-//Called when user touches our 'Play' button.  +
-function btnPlay_OnTouch()  +
-{  +
-var destFile = "/sdcard/test.wav"  +
-var timer = 0;  +
-    player.SetFile( destFile );  +
-}  +
- +
-//Called when the WAV file is loaded.  +
-function player_OnReady()  +
-{  +
-     player.Play();  +
-}  +
- +
- +
- +
-    +
-</script> +
- +
-<style> +
-    body { background-color: black; } +
-    .hello  +
-    {  +
-        font-size: 20;  +
-        width: 100%; +
-        margin-short: 2em; +
-        text-align: center; +
-        color: blue; +
-    } +
-</style> +
- +
-<body onload="app.Start()"> +
- +
-    <div class=hello>Gravador de voz <font-size="15"><font color="red">(Teste)</font></font></div> +
-     +
-</body> +
-</body> +
-</html> +
- +
- +
- +
- +
  
 =====Introduction===== =====Introduction=====
Line 167: Line 12:
  
 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. 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.
 +
 +e.g. image is stored in "/sdcard/DroidScript/yourapp/Img/xxx.jpg", you should name the path as "Img/xxx.jpg" instead. Otherwise, while you generate the APK, it will not be included as Android Assets.
  
 =====How can you get this plugin?===== =====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.  +The ApkBuilder plugin is **not** free. You have to pay a little money for it. But if you bought it, you can build as many apk files as you want! The plugin works entirely offline. But after each new installation of DroidScript you should **reinstall** (no new buying) the plugin to bring it up to date with the new version
-You can download it over the Plugin-Section within DroidScript.+You can download or **reinstall** it over the Plugin-Section within DroidScript.
  
 =====First Start===== =====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!**\\+After the first start of the plugin you must create a **user.keystore** 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:=== ===Here is a warning from Dave, developer of DroidScript:===
plugins/apk_builder.1435703109.txt.gz · Last modified: 2015/07/01 06:25 (external edit)