-
//返回设备唯一的 id
-
public static String J_C_getIosDeviceId()
-
{
-
String android_id = Secure.getString(getContext().getContentResolver(), Secure.ANDROID_ID);
-
return android_id;
-
}
-
//判断当前是否有可用网络
-
public static boolean J_C_isNetworkOK()
-
{
-
//获取当前的网络连接服务
-
-
try {
-
ConnectivityManager connectivity = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
-
if (connectivity != null) {
-
-
NetworkInfo info = connectivity.getActiveNetworkInfo();
-
if (info != null && info.isConnected()) {
-
-
if (info.getState() == NetworkInfo.State.CONNECTED) {
-
return true;
-
}
-
}
-
}
-
} catch (Exception e) {
-
return false;
-
}
-
return false;
-
-
}
-
-
//打开url
-
public static void J_C_toOpenNetworkURL(String url)
-
{
-
Uri uri = Uri.parse(url);
-
Intent it = new Intent(Intent.ACTION_VIEW, uri);
-
getContext().startActivity(it);
-
}
对应 ios DeviceId 代码参考:
//获得临时的UUID
std::string getIosDeviceId()
{
std::string m_str;
NSString* idStr = [OpenUDID value]; //
m_str = [idStr UTF8String];
return m_str;
}
阅读(13353) | 评论(0) | 转发(1) |