这是我使用的代码
private String android_id = Secure.getString(this.getContentResolver(),
Secure.ANDROID_ID);
我是否需要向我的 list 添加权限才能访问此变量?
最佳答案
我在 onCreate 中设置了 android_id 现在它可以工作了
private String android_id;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent intent = getIntent();
android_id = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
关于java - 我似乎无法获得 android_id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22151971/