Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.content.SharedPreferences; public class Main { public static final String DEVICEID = "deviceid"; public static final String DEVICE = "device"; public static String getDeviceId(Context context) { SharedPreferences preferences = context.getSharedPreferences(DEVICE, Context.MODE_PRIVATE); String deviceid = preferences.getString(DEVICEID, "android"); return deviceid; } }