Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;

import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.text.TextUtils;

public class Main {
    private static TelephonyManager telephonyManager;
    private static Context mContext;

    public static String getDeviceId() {
        String IMEI = telephonyManager.getDeviceId();
        if (TextUtils.isEmpty(IMEI)) {
            IMEI = Settings.Secure.getString(mContext.getContentResolver(), Settings.Secure.ANDROID_ID);
        }
        return IMEI;
    }
}