update: 添加 Android 设备获取信息 TryCatch 块
Signed-off-by: huyufei <yufei.hu@castbox.fm>deeplink
parent
7867db4655
commit
e2c3b5bc7c
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
|
|
@ -34,6 +35,9 @@ namespace Guru
|
|||
private static void GetIOSDeviceInfo()
|
||||
{
|
||||
#if UNITY_IOS
|
||||
try
|
||||
{
|
||||
Debug.Log($"[SDK] --- GetIOSDeviceInfo:: iOSDeviceInfo<string>");
|
||||
string content = iOSDeviceInfo();
|
||||
Debug.Log($"GetDeviceInfo:{content}");
|
||||
if(!string.IsNullOrEmpty(content))
|
||||
|
|
@ -48,9 +52,12 @@ namespace Guru
|
|||
IPMConfig.IPM_COUNTRY_CODE = infos[6];
|
||||
IsGetDeviceInfoSuccess = true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError(ex);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void SetiOSBadge()
|
||||
|
|
@ -82,9 +89,12 @@ namespace Guru
|
|||
private static void GetAndroidDeviceInfo()
|
||||
{
|
||||
#if UNITY_ANDROID
|
||||
try
|
||||
{
|
||||
_androidJavaObject ??= new AndroidJavaObject("com.guru.u3d2android.u3d2android");
|
||||
if (_androidJavaObject != null)
|
||||
{
|
||||
Debug.Log($"[SDK] --- GetAndroidDeviceInfo:: com.guru.u3d2android.u3d2android: getDeviceInfo<string>");
|
||||
string content = _androidJavaObject.Call<string>("getDeviceInfo");
|
||||
Debug.Log($"GetDeviceInfo:{content}");
|
||||
if(!string.IsNullOrEmpty(content))
|
||||
|
|
@ -99,6 +109,11 @@ namespace Guru
|
|||
IsGetDeviceInfoSuccess = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError(ex);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue