机器人执行在模拟器或设备? [英] android execution in emulator or device?

查看:126
本文介绍了机器人执行在模拟器或设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法知道,如果我的应用程序在模拟器或设备?

上运行
解决方案

  Secure.getString(getContentResolver(),Secure.ANDROID_ID);
 

(其中安全 android.provider.Settings.Secure

该值将是在模拟器上,设备上非空。

Is there any way to know if my application is running on the emulator or on the device ?

解决方案

Secure.getString(getContentResolver(), Secure.ANDROID_ID); 

(where Secure is android.provider.Settings.Secure)

That value will be null on the emulator, non-null on devices.

这篇关于机器人执行在模拟器或设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆