AndroidBridge

Providing Unity developers with complete access to Android platform without needing additional plugins

phone
TECHNOLOGY

We've covered all bases

Our patent pending technology allows developers to virtually bridge any two languages and runtimes. While adding only a tiny overhead over manual binding solutions, we enable support for polymorphism, multi-threading and garbage collection while retaining as much language features and structure as possible.

Polymorphism

You can extend classes, implement interfaces and even override methods of one language in another.

Multithreading

You can easily spawn new threads to access time consuming APIs without slowing the main thread down.

Garbage Collection

We passively take out the garbage for you whenever possible without affecting runtime performance.

Discover AndroidBridge

AndroidBridge is a unity plugin that bridges Unity platform with Android. It provides Unity developers with complete access to Android and Java platform. With AndroidBridge you can grow Unity from a game engine to a full blown app development engine for Android (and soon for iOS too with the upcoming launch of iOSBridge). There are numerous benefits of using AndroidBridge over other solutions. Please, check out the documentation to learn more.

Documentation
perspective phone
EXAMPLES

Let's get started

Working with AndroidBridge is easier than you think. You should definitely read the documentation for a deep dive but until then look at the the examples below to whet your apetite and get you going for your first project. Also, remember that before you can actually use any of Android's types inside Unity, you will need to generate stub types by going to Window | AndroidBridge.

using UnityEngine;
using AndroidBridgeEngine;

using java.lang;
using android.app;
using android.widget;

public class MainScript : MonoBehaviour, Runnable 
{
	
	private Activity context;

	void Start ()
	{
		AndroidTerminal.Initialize ();

		new System.Threading.Thread (() => {
			context = (Activity)AndroidTerminal.ActivityContext;
			context.runOnUiThread (this);
		}).Start ();
	}

	public void run ()
	{
		// We will have to convert string to java.lang.CharSequence 
		// as .net string doesn't implement that interface
		// Alternatively, we can also cast C# string to Java's
		// like (java.lang.String)"Hello, World!"

		Toast.makeText (context, "Hello, World!".ToCharSequence(), Toast.LENGTH_LONG).show ();
	}
}
using UnityEngine;
using AndroidBridgeEngine;

using java.lang;
using android.app;
using android.view;
using android.widget;
using android.content;

public class MainScript : MonoBehaviour, Runnable, DialogInterfaceʼOnClickListener
{
	
	private Activity context;
	private EditText editText;

	void Start ()
	{
		AndroidTerminal.Initialize ();

		new System.Threading.Thread (() => {
			context = (Activity)AndroidTerminal.ActivityContext;
			context.runOnUiThread (this);
		}).Start ();
	}

	private View BuildLayout ()
	{
		LinearLayout layout = new LinearLayout (context);

		layout.setLayoutParams (
			new LinearLayoutʼLayoutParams (
				LinearLayoutʼLayoutParams.MATCH_PARENT,
				LinearLayoutʼLayoutParams.MATCH_PARENT));
		
		layout.setOrientation (LinearLayout.VERTICAL);

		TextView textView = new TextView (context);
		textView.setLayoutParams (
			new LinearLayoutʼLayoutParams (
				LinearLayoutʼLayoutParams.WRAP_CONTENT,
				LinearLayoutʼLayoutParams.WRAP_CONTENT));

		textView.setText ("What's your name developer?".ToCharSequence());

		editText = new EditText (context);
		editText.setLayoutParams (
			new LinearLayoutʼLayoutParams (
				LinearLayoutʼLayoutParams.MATCH_PARENT,
				LinearLayoutʼLayoutParams.WRAP_CONTENT));

		layout.addView (textView);
		layout.addView (editText);

		return layout;
	}

	// java.lang.Runnable
	public void run ()
	{
		AlertDialogʼBuilder alertDialogBuilder = new AlertDialogʼBuilder (context);
		alertDialogBuilder.setView (BuildLayout ());
					
		alertDialogBuilder.setCancelable (false);
		alertDialogBuilder.setPositiveButton ("OK".ToCharSequence(), this);
					
		AlertDialog alertDialog = alertDialogBuilder.create ();
					
		// show it
		alertDialog.show ();
	}
		
	// android.content.DialogInterface.OnClickListener
	public void onClick (DialogInterface dialog, int id)
	{
		string message = "Happy coding " + editText.getText ().toString ().Trim () + "!";
		Toast.makeText (context, message.ToCharSequence(), Toast.LENGTH_LONG).show ();

		// We're not expecting any more callbacks from Android
		AndroidTerminal.Finalize (this);
	}
}
using System;
using UnityEngine;
using AndroidBridgeEngine;

using java.lang;
using android.app;
using android.view;
using android.widget;
using android.content;

public class MainScript : MonoBehaviour
{
	
	private Activity context;
	private EditText editText;
	private NotificationManager nManager;
	private android.content.res.Resources r;

	void Start ()
	{
		AndroidTerminal.Initialize ();

		new System.Threading.Thread (() => {
			context = (Activity)AndroidTerminal.ActivityContext;
			Notify("Hello", "You have been notified!");
		}).Start ();
	}

	private int GetDrawableId(string drawableName)
	{
		if (r == null) {
			r = context.getResources ();
		}

		return r.getIdentifier(drawableName, "drawable", UnityEngine.Application.identifier);
	}

	private void Notify(java.lang.String title, java.lang.String message) 
	{
		if (nManager == null) {
			nManager = (NotificationManager)context.getSystemService(Activity.NOTIFICATION_SERVICE);
		}

		NotificationʼBuilder mBuilder = new NotificationʼBuilder(context);
		mBuilder.setSmallIcon(GetDrawableId("app_icon"));
		mBuilder.setContentTitle(title);
		mBuilder.setContentText(message);
		nManager.notify (Environment.TickCount, mBuilder.build ());
	}
}
using System;
using UnityEngine;
using AndroidBridgeEngine;

using java.io;
using java.lang;
using android.app;

public class MainScript : MonoBehaviour
{
	
	private Activity context;

	void Start ()
	{
		AndroidTerminal.Initialize ();

		new System.Threading.Thread (() => {
			context = (Activity)AndroidTerminal.ActivityContext;
			WriteToFile();
		}).Start ();
	}

	void WriteToFile() {
		string filename = "myfile";
		java.lang.String fileContents = "Hello Files!";
		FileOutputStream outputStream;
		FileInputStream inputStream;

		try {
			outputStream = context.openFileOutput(filename, Context.MODE_PRIVATE);
			outputStream.write(fileContents.getBytes());
			outputStream.close();
			//

			inputStream = context.openFileInput(filename);
			int content;
			string str = "";
			while ((content = inputStream.read()) != -1) {
				str += (char) content;
			}
			inputStream.close();
			Debug.Log(str);
		} catch {
			Debug.Log ("There was some error writing the file.");
		}
	}
}
PRICING

Lite vs Pro

Support the development of AndroidBridge by buying the Lite version now and upgrade to Pro version later for only $50. There are guaranteed discounts for early adopters of AndroidBridge at the launch of iOSBridge as well, which will be announced closer to the launch of iOSBridge.

Pro $125
    Android API's: All (16-27)
    Multithreading
    Garbage Collection
    Unlimited Bridge Types
    Performance x4
    JAR and AAR support
    Priority Support
FAQ

Frequently Asked Questions

What versions of Unity are supported?

All our products have been tested to work with Unity 2017 and above.

What's the packaging overhead for 'thin-clients' packaged with my Unity app/game?

Although the ultimate size depends on the number of types being bridged but the 'thin-clients' themselve only add about 1.5 Mb to the overall package.

Can I buy the products directly without going through Unity Asset Store?

Unfortunately, we are not accepting direct payments at this time and you must make your purchases via Unity Asset Store.

Are there any plans to launch this for Unreal and/or other engines and platforms?

There are plans to launch a bridging tool for Android and iOS for JS/Web developers that can let them access the entire platforms. Unreal and/or engines will be supported if there is enough demand for them. So, keep us posted with what you want.

AndroidBridge Lite is available to purchase from Unity Asset Store. AndroidBridge Pro and iOSBridge are coming soon.

*Unity 2017 and above.