简体   繁体   中英

I can not seem to get the android_id

Here is the code i am using

private String android_id = Secure.getString(this.getContentResolver(),
        Secure.ANDROID_ID);

Do I need to add permission to my manifest to have access to this variable?

i set android_id in onCreate now it works

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM