get Device Id - Android android.provider

Android examples for android.provider:Settings

Description

get Device Id

Demo Code

import android.content.Context;
import android.provider.Settings;
import android.telephony.PhoneNumberUtils;
import java.io.File;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Random;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main{

    public static String getDeviceId(Context context) {
        return Settings.Secure.getString(context.getContentResolver(),
                Settings.Secure.ANDROID_ID);
    }//from   w ww.j  a  v a 2s .c o m

}

Related Tutorials