internal static void RequestStoreReview(string callbackObject, string callbackMethod) { AndroidUtil.CallJavaStaticMethod(ANDROID_JAVA_UTILITY_CLASS, "RequestStoreReview", callbackObject, callbackMethod ); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource // SetContentView(Resource.Layout.Main); AndroidGraphicFactory.CreateInstance(Application); this.mapView = new MapView(this); SetContentView(this.mapView); this.mapView.Clickable = true; this.mapView.MapScaleBar.Visible = true; this.mapView.SetBuiltInZoomControls(true); this.mapView.SetZoomLevelMin(10); this.mapView.SetZoomLevelMax(20); this.tileCache = AndroidUtil.CreateTileCache(this, "mapcache", mapView.Model.DisplayModel.TileSize, 1f, this.mapView.Model.FrameBufferModel.OverdrawFactor); MapDataStore mapDataStore = new MapFile(new File(Android.OS.Environment.ExternalStorageDirectory, "chile.map")); this.tileRendererLayer = new TileRendererLayer(tileCache, mapDataStore, this.mapView.Model.MapViewPosition, AndroidGraphicFactory.Instance); tileRendererLayer.SetXmlRenderTheme(InternalRenderTheme.Osmarender); this.mapView.LayerManager.Layers.Add(tileRendererLayer); mapView.SetCenter(new LatLong(-33.44, -70.68)); // Get our button from the layout resource, // and attach an event to it //Button button = FindViewById<Button>(Resource.Id.MyButton); //button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); }; }
private Vector4 GetSafePadding() { Vector4 v_result = Vector4.zero; #if UNITY_EDITOR if (FakeDevice == DeviceType.IPHONEX_L) { v_result.Set(48, 0, 0, 0); } else if (FakeDevice == DeviceType.IPHONEX_R) { v_result.Set(0, 0, 48, 0); } else if (FakeDevice == DeviceType.IPHONEX_LR) { v_result.Set(48, 0, 48, 0); } #elif IN_GAME && UNITY_IOS float l, t, r, b; GetSafeOffsetImpl(out l, out t, out r, out b); v_result.Set(l, t, r, b); #elif IN_GAME && UNITY_ANDROID float ratio = 1.0f; bool bHasNotch = AndroidUtil.HasNotchInScreen() && (!AndroidUtil.IgnoreNotchScreen()); if (bHasNotch) { v_result.Set(48 * ratio, 0, 0, 0); } #endif return(v_result); }
internal static void _CancelAllShownNotifications() { AndroidUtil.CallJavaStaticMethod( ANDROID_JAVA_CLASS, "_CancelAllShownNotifications" ); }
private void OnApplicationPause(bool pauseStatus) { if (pauseStatus) { // 나갔을 때 } else { // 다시 들어왔을 때 if (PlayerPrefs.GetFloat("Merchant3", 0) == 0) { if (AndroidUtil.IsAppInstalled("game.Tylenol.CTDT")) { PlayerPrefs.SetFloat("Merchant3", 1); DataController.Instance.ruby += 1000; if (Application.systemLanguage == SystemLanguage.Korean) { NotificationManager.Instance.SetNotification2("루비 1,000개가 지급되었습니다."); } else { NotificationManager.Instance.SetNotification2("Get 1,000 Ruby!!"); } Panel.SetActive(false); } } } }
internal static void _ScheduleLocalNotification( string id, long delaySecs, long repeatSecs, string title, string body, string userInfoJson, string categoryId, string smallIcon, string largeIcon) { AndroidUtil.CallJavaStaticMethod( ANDROID_JAVA_CLASS, "_ScheduleLocalNotification", id, delaySecs, repeatSecs, title, body, userInfoJson, categoryId, smallIcon, largeIcon ); }
internal static void _CancelAllPendingLocalNotificationRequests() { AndroidUtil.CallJavaStaticMethod( ANDROID_JAVA_CLASS, "_CancelAllPendingLocalNotificationRequests" ); }
internal static void _GetPendingLocalNotifications(Action <AndroidNotificationRequest[]> callback) { Helper.NullArgumentTest(callback); var requests = new List <AndroidNotificationRequest>(); var jObj = AndroidUtil.CallJavaStaticMethod <AndroidJavaObject>( ANDROID_JAVA_CLASS, "_GetPendingNotificationRequestsJson"); // The JNI array conversion method will crash if the raw object value is 0. if (jObj.GetRawObject().ToInt32() != 0) { var jsonStrs = AndroidJNIHelper.ConvertFromJNIArray <string[]>(jObj.GetRawObject()); foreach (string s in jsonStrs) { var req = AndroidNotificationRequest.FromJson(s); if (req != null) { requests.Add(req); } } } jObj.Dispose(); callback(requests.ToArray()); }
public void OnPointerClick(PointerEventData eventData) { if (!longPressTriggered) { AndroidUtil.Toast("长按5s进入家长中心~~"); } }
public void OnPurchaseFailed(Product product, PurchaseFailureReason p) { Debug.Log(string.Format("IAP::OnPurchaseFailed PurchaseFailureReason:{0}", p)); int purchaseType = 0; string udid = ""; #if UNITY_IOS || UNITY_IPHONE purchaseType = 1; //Apple Store EPlatformType.EPlatformType_AppStore udid = IOSUtil.iosGetOpenUDID(); #elif UNITY_ANDROID purchaseType = 2; //Google Play EPlatformType.EPlatformType_GooglePlay udid = AndroidUtil.GetOpenUDID(); #endif var transactionID = product.transactionID; var pid = product.definition.id; //Write cache FileBilling.Instance.ReadFile(); FileBilling.CReceiptInfo entry = new FileBilling.CReceiptInfo(); entry.RoleId = _roleId; entry.ProductId = pid; entry.BillingType = purchaseType; entry.IsSucceed = false; entry.TransactionId = transactionID; FileBilling.Instance.Update(purchaseType, entry); FileBilling.Instance.WriteFile(); PostVerifyData(_roleId, _roleId, purchaseType, pid, transactionID, udid, "", "", false, false); // Callback PURCHASE_INFO info = new PURCHASE_INFO(); info.iBillingType = purchaseType; info.strTransactionId = product.transactionID; _fnPurchaseCallback(false, info); }
public double GetDevicePPIY() { #if ANDROID return(AndroidUtil.GetDevicePPIY(activity.Resources)); #elif IOS #endif }
public void OnClickCallBtn() { //TODO 判断电话号码是否正确 var fatherPhone = PlayerPrefs.GetString("fatherPhone"); var motherPhone = PlayerPrefs.GetString("motherPhone"); if (fatherPhone.Length == 0 && motherPhone.Length == 0) { AndroidUtil.Toast("请去家长中心设置父母的电话号码~~~"); } else { if (phoneNumber.text.Equals(fatherPhone) || phoneNumber.text.Equals(motherPhone)) { policePanel.SetActive(false); rightPanel.SetActive(true); boyAnimator.SetBool("isSmile", true); } else { policePanel.SetActive(false); errorPanel.SetActive(true); } } }
public double GetActualSize(double value) { #if ANDROID return(AndroidUtil.GetActualSize(activity.Resources, value)); #elif IOS #endif }
internal static void _CancelPendingLocalNotificationRequest(string id) { AndroidUtil.CallJavaStaticMethod( ANDROID_JAVA_CLASS, "_CancelPendingLocalNotificationRequest", id ); }
public static int GetMemoryLimit() { #if UNITY_ANDROID return(AndroidUtil.GetMemoryLimit()); #else return(0); #endif }
public static void OpenUrl(string url) { #if UNITY_IOS IOSUtil.iosOpenUrl(url); #elif UNITY_ANDROID AndroidUtil.OpenUrl(url); #endif }
void Start() { Input.backButtonLeavesApp = true; Url += AndroidUtil.GetImei(); Init(); _webViewObject.LoadURL(Url); _webViewObject.SetVisibility(true); }
//用于Unity下调试手写识别结果反馈 public void TestHWRRec(string results) { AndroidUtil.Log("识别到的结果:" + results); if (results != null && results.Length >= 1) { WordHandler._instance.SetCharacter(results.Substring(0, 1)); } }
public static int getTotalPss() { #if UNITY_ANDROID return(AndroidUtil.getTotalPss()); #else return(0); #endif }
public static void RequestPhotoPermission() { #if UNITY_IOS IOSUtil.RequestPermission((int)IOSUtil.PermissionType.PermissionPhotoLibrary); #elif UNITY_ANDROID AndroidUtil.RequestPermission(AndroidUtil.CODE_WRITE_EXTERNAL_STORAGE); #else #endif }
public static void RequestCameraPermission() { #if UNITY_IOS IOSUtil.RequestPermission((int)IOSUtil.PermissionType.PermissionCamera); #elif UNITY_ANDROID AndroidUtil.RequestPermission(AndroidUtil.CODE_CAMERA); #else #endif }
public static void RequestRecordAudioPermission() { #if UNITY_IOS IOSUtil.RequestPermission((int)IOSUtil.PermissionType.PermissionMicrophone); #elif UNITY_ANDROID AndroidUtil.RequestPermission(AndroidUtil.CODE_RECORD_AUDIO); #else #endif }
/// <summary> /// Gets the screen height of the device adjusted for DPI /// </summary> /// <returns></returns> public double GetScreenHeight() { #if ANDROID return(AndroidUtil.GetViewAreaHeight(activity.Resources)); #elif IOS return(iOSUtil.GetRawViewHeight()); #else throw new NotImplementedException(); #endif }
public void OnClickRegisterBtn() { if (GeneralUtils.IsStringEmpty(AccountInputField.text) || GeneralUtils.IsStringEmpty(pwdInputField.text)) { AndroidUtil.Toast("用户或密码不能为空"); return; } RegisterAccount(AccountInputField.text, pwdInputField.text); }
public void OnClickLoginBtn() { if (GeneralUtils.IsStringEmpty(accountInputField.text) || GeneralUtils.IsStringEmpty(pwdInputField.text)) { AndroidUtil.Toast("用户或密码不能为空"); return; } LoginAccount(accountInputField.text, pwdInputField.text); }
public static bool HasPhotoPermission() { #if UNITY_IOS return(IOSUtil.HasPermission((int)IOSUtil.PermissionType.PermissionPhotoLibrary)); #elif UNITY_ANDROID return(AndroidUtil.HasPermission(AndroidUtil.CODE_WRITE_EXTERNAL_STORAGE)); #else return(true); #endif }
public static bool HasCameraPermission() { #if UNITY_IOS return(IOSUtil.HasPermission((int)IOSUtil.PermissionType.PermissionCamera)); #elif UNITY_ANDROID return(AndroidUtil.HasPermission(AndroidUtil.CODE_CAMERA)); #else return(true); #endif }
public static bool HasRecordAudioPermission() { #if UNITY_IOS return(IOSUtil.HasPermission((int)IOSUtil.PermissionType.PermissionMicrophone)); #elif UNITY_ANDROID return(AndroidUtil.HasPermission(AndroidUtil.CODE_RECORD_AUDIO)); #else return(true); #endif }
public static string getMemotryStats() { #if UNITY_ANDROID return(AndroidUtil.getMemotryStats()); #else long vm = GetVirtualMemoryUsedSize() / (1024 * 1024); long pm = GetPhysMemoryUsedSize() / (1024 * 1024); return(string.Format("Virtual MEM: {0}M, Physics MEM: {1}M", vm, pm)); #endif }
public static string GetResponseOSVersionString() { #if UNITY_IOS return(UnityEngine.SystemInfo.operatingSystem); //IOSUtil.iosGetSysVersion(); #elif UNITY_ANDROID return(AndroidUtil.GetSysVersion()); #else return(string.Empty); #endif }