Expo Is The Peep Squeak To DroidScript.


DroidScript also formerly known as AndroidScript, is a javascript framework (more of a bridge between native android api’s and jacvascript using V8 normally*.
That means you can create interfaces natively, no mimicking using HTML or using another rendering engine.

That also means the hundreds of lines of Java or Kotlin (XML or Using Jetpack Compose) you have to write can be reduced to 1 to 10 for every Api and component.

Everything is as clear as daytime.
Please note i am not affiliate with DroidScript, i am not an employee, and i just build plugins for use by other developers for free.


That comes down to timing, just like Haxe its initial release never gained it traction, even though both are good.
But that doesn’t mean its not being used widely.

Also its path has been a rocky one, the following trials and tribulations have contributed:

DroidScript is an offline ide that allows access to Api’s like file exposure and given this state, it means bad actors could do illegal activities and could be tired to the application using its package name

Because of this DroidScript has been outed for AdMob Misuse, which could have came from bad actors running unbuilt projects on the IDE, which exploit AdMob. Therefore after the 2020 Incident, Almost banning it, its not supported anymore.

I’ve tried to summarize the AdMob Misuse Issue, its very controversial debate. Hacker News Thread


DroidScript code is available to view fully, the java Implementation, js Bridge (app.js) and Documentation can all be found on GitHub, however its a paid platform.

I’m a for free and open things guy, but i have a special case here, given maintenance of the project since 2014 and supporting alot of the messy javascript ecosystem.
To Me 0.49$ is great, remember you can use it even without paying, only payment required for building projects.


This code block, creates a layout and adds a progress bar.

DroidScript

/* Use J2V8 Instead Of V8 */
cfg.Fast
/* Import Material 2 */
cfg.MUI /* Import Material 3 Plugin, Built By Me */ app.LoadPlugin('Material3') function OnStart(){ app.CreateMaterial3(); lay = ui.createLayout('Linear','FillXY') progressLoader = ui.addProgressBar('linear',0.85,lay) progressLoader.SetMargins(null,0.4) progressLoader.SetValue(79) app.AddLayout(lay)
}
Enter fullscreen mode
Exit fullscreen mode

Java

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ProgressBar;
import android.widget.RelativeLayout; public class MainActivity extends AppCompatActivity { private RelativeLayout mainLayout; private ProgressBar progressLoader; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mainLayout = findViewById(R.id.main_layout); progressLoader = findViewById(R.id.progressLoader); progressLoader.setPadding(0, 0, 0, 0); // Adjust padding if needed }
} 
Enter fullscreen mode
Exit fullscreen mode

And :

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="16dp"> <ProgressBar android:id="@+id/progressLoader" style="@android:style/Widget.ProgressBar.Horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerVertical="true" android:progress="79" android:layout_marginTop="160dp" /> </RelativeLayout> 
Enter fullscreen mode
Exit fullscreen mode

On a large project i.e Reddit, it would be easier to do this on DroidScript, less time swapping between XML and Java, just statements.

Another Example Using Camera :

DroidScript

function OnStart()
{ lay = app.CreateLayout( "Linear", "VCenter,FillXY" ); cam = app.CreateCameraView( 0.8, 0.4 ); cam.SetOnReady( cam_OnReady ); lay.AddChild( cam ); app.AddLayout( lay );
} function cam_OnReady() {
cam.StartPreview();
}
Enter fullscreen mode
Exit fullscreen mode

Java

  • Android Manifest
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="true"/> 
Enter fullscreen mode
Exit fullscreen mode
import android.app.Activity;
import android.hardware.Camera;
import android.os.Bundle;
import android.view.SurfaceHolder;
import android.view.SurfaceView; import java.io.IOException; public class CameraActivity extends Activity implements SurfaceHolder.Callback { private Camera mCamera; private SurfaceView mSurfaceView; private SurfaceHolder mSurfaceHolder; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_camera); mSurfaceView = findViewById(R.id.surfaceView); mSurfaceHolder = mSurfaceView.getHolder(); mSurfaceHolder.addCallback(this); } @Override public void surfaceCreated(SurfaceHolder holder) { mCamera = Camera.open(); try { mCamera.setPreviewDisplay(holder); mCamera.startPreview(); } catch (IOException e) { e.printStackTrace(); } } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { // No need to handle this for simplicity } @Override public void surfaceDestroyed(SurfaceHolder holder) { mCamera.stopPreview(); mCamera.release(); }
} 
Enter fullscreen mode
Exit fullscreen mode
  • Layout XML
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <SurfaceView android:id="@+id/surfaceView" android:layout_width="match_parent" android:layout_height="match_parent" /> </RelativeLayout> 
Enter fullscreen mode
Exit fullscreen mode

Quick OverView

  • DroidScript detects what you need and takes care of permissions
  • DroidScript supports native android development and in the future a WORA viewpoint, except backend lol 😭😭😭.

I will do a much better explained part 2 if this does well
or i can squeeze whatever motivation i have.

Sorry For Mentioning Expo, You Wouldn’t Read 🫠
Ill cover it on the next so you better follow, or else you will break a database and have your code sql injected and fired. 🫠


Discover more from Coursity

Subscribe to get the latest posts sent to your email.

Leave a Comment

Your email address will not be published. Required fields are marked *

Discover more from Coursity

Subscribe now to keep reading and get access to the full archive.

Continue reading

Scroll to Top
Screen reader users also get automatic announcements to turn the screen reader mode on as soon as they enter the website.