The goal when building AndroidBuddy was to craft functional software to extend Unity's reach into the Native Android OS. A key part of this was to keep things as simple as possible. Simple software is friendly. Simple software is reliable. Simple software is beautiful.

Note: Currently, only for Unity 5 Games (Runtime Android 6 permission requests require 5.3.2p2 or above)

Setup Guide

Runtime Permissions Guide

General Usage

No need to drag and drop Prefabs, attach scripts or any poo like that - AndroidBuddy comes with no sticky strings attached. Simply start referencing AndroidBuddy.Instance in your code and we'll add what we need to your scene at runtime. Many have said, "It's magic".

This plugin uses the Signalphire namespace; remember to reference Android within the namespace:

using Signalphire;

var versionName = AndroidBudddy.Instance.AppVersionName;

-- or --

var versionName = Signalphire.AndroidBudddy.Instance.AppVersionName;

Due to the nature of communicating with the local Android OS, there could be a minimal frame execution time spike when you first call anything AndroidBudddy.Instance. If you would like to have more control over when this happens, a helper method is available for you to call at a specific point in time in your game's lifecycle that suits the slightly expensive operation best.


Google Advertising ID (GAID)

Retrieval of the Google Advertising ID is performed synchronously in a separate thread. You should add a handler for this as early as possible in your application lifecycle. The Awake() method is typically a good place for this:

void Awake()
    AndroidBuddy.OnGoogleAdvertisingIdRetrieved += (gaid) =>
        Debug.Log("SampleRunner - received Google Advertising Id: " + gaid);

GAID is also available any time after this callback has fired, via:


Scheduling local notifications

Note that the 3rd parameter is the delay in seconds.

AndroidBuddy.Instance.ScheduleLocalNotification("Message from AndroidBuddy", "20 sec local notif", 20);

The app_icon resource will be used by default for the notification icon. If you wish to use a custom icon, pease follow the Android Design Guidelines, and place the resources in Assets/Plugins/Android/res/drawable-* folders. Be sure to give the icon a unique name, and set this name via the Android Buddy API, e.g.:


Custom notification sounds can be set in a similar way, with the exception of placing the .mp3 audio file in Assets/Android/Plugins/res/raw, and then setting this file name via the Android Buddy API, e.g.:


Retrieving Native Device Info

string versionName = AndroidBuddy.Instance.AppVersionName;
string versionCode = AndroidBuddy.Instance.AppVersionCode;
string packageName = AndroidBuddy.Instance.PackageName;
string googleAdvertisingId = AndroidBuddy.Instance.GoogleAdvertisingId;
string androidId = AndroidBuddy.Instance.AndroidId;

Showing Android Toast

AndroidBuddy.Instance.ShowToast("Permission previously denied; show rationale", AndroidBuddy.ToastDuration.SHORT);


Fully functional sample scene and script located in Assets/AndroidBuddy/Sample