public DataExportServiceProxy() : base("org.ekstep.genieservices.sdks.export.IManageDataExport") { AndroidJavaObject sdkService = new AndroidJavaObject("org.ekstep.genieservices.sdks.SdkFactory"); sdkService.Call("initializeExportService", AndroidHelper.GetCurrentActivity(), this); }
public void ShowAndDispose() { AndroidJavaObject context = AndroidHelper.GetCurrentActivity().Call <AndroidJavaObject>("getApplicationContext"); AndroidJavaObject toastClass = new AndroidJavaClass("android.widget.Toast"); AndroidJavaObject toastObject = toastClass.CallStatic <AndroidJavaObject>("makeText", context, m_Message, (int)m_Duration); toastObject.Call("show"); toastClass.Dispose(); toastObject.Dispose(); context.Dispose(); }
static public void KillActivity() { Application.Quit(); #if UNITY_ANDROID && !UNITY_EDITOR try { AndroidJavaObject currentActivity = AndroidHelper.GetCurrentActivity(); currentActivity.Call("finish"); } catch (System.Exception e) { Debug.LogFormat("Unable to kill application: {0}", e.Message); } #endif }
static public void Vibrate(float inSeconds) { #if UNITY_ANDROID AndroidJavaClass context = new AndroidJavaClass("android.content.Context"); string serviceKey = context.GetStatic <string>("VIBRATOR_SERVICE"); context.Dispose(); AndroidJavaObject service = AndroidHelper.GetCurrentActivity().Call <AndroidJavaObject>("getSystemService", serviceKey); bool bHasVibrator = service.Call <bool>("hasVibrator"); if (bHasVibrator) { service.Call("vibrate", (long)(inSeconds * 1000)); } service.Dispose(); #endif }
static public bool LaunchActivity(string inActivityName) { #if UNITY_ANDROID && !UNITY_EDITOR try { AndroidJavaObject currentActivity = AndroidHelper.GetCurrentActivity(); AndroidJavaObject packageManager = currentActivity.Call <AndroidJavaObject>("getPackageManager"); AndroidJavaObject launchIntent = packageManager.Call <AndroidJavaObject>("getLaunchIntentForPackage", inActivityName); currentActivity.Call("startActivity", launchIntent); return(true); } catch (System.Exception e) { Debug.LogFormat("Unable to open '{0}': {1}", inActivityName, e.Message); return(false); } #else return(false); #endif }
public AlertDialogBuilder() : base(new AndroidJavaObject("android.app.AlertDialog$Builder", AndroidHelper.GetCurrentActivity())) { SetCancelable(false); }
public TelemetryProxy() : base(new AndroidJavaObject("org.ekstep.genieservices.sdks.Telemetry", AndroidHelper.GetCurrentActivity())) { }
public UserProfileProxy() : base(new AndroidJavaObject("org.ekstep.genieservices.sdks.UserProfile", AndroidHelper.GetCurrentActivity())) { }