User Tools

Site Tools


Sidebar

Privacy Policy

News

Version 2.50 is out since Jan 1st 2022


Frequently Asked Questions


Namespaces

Note for contributors

If you wish to create a new page in the DroidScript wiki, please click on the most appropriate namespace above and follow the notes for contributors there.

Because of spam, it has been necessary to add a CAPTCHA to the registration form and the save option for editing pages. You will not need to prove you are human if you are logged in, so please register.

Please feel free to improve any existing page, as well as adding new pages to increase the sum of public knowledge about DroidScript.

Formatting Syntax

plugins:apk_builder

This is an old revision of the document!


<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>

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.1435703109.txt.gz · Last modified: 2015/07/01 06:25 (external edit)