读书人

判断真机仍是模拟器

发布时间: 2012-09-05 15:19:35 作者: rapoo

判断真机还是模拟器

?TelephonyManager telmgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);?? ? ? ? ? ? ? ? String deviceID = telmgr.getDeviceId();?
? ? ? ? ? ? ? ? boolean isEmulator = "000000000000000".equalsIgnoreCase(deviceID);?
?
????????????????
??????????????? if (isEmulator) {?
? ? ? ? ? ? ? ? ? ? ((myApp) getApplication()).setBitmapX(BitmapFactory.decodeFile(imageFileName));?
? ? ? ? ? ? ? ? } else {?
? ? ? ? ? ? ? ? ? ? ((myApp) getApplication()).setBitmapX(BitmapFactory.decodeByteArray((byte[]) args[0], 0, ((byte[])args[0]).length));?
? ? ? ? ? ? ? ? }?

读书人网 >移动开发

热点推荐