check By Device IDS - Android Hardware

Android examples for Hardware:Device ID

Description

check By Device IDS

Demo Code


import android.content.Context;
import android.telephony.TelephonyManager;
import android.text.TextUtils;

public class Main {
  private static String[] kKNOWN_DEVICE_IDs = { "000000000000000" };

   static boolean checkByDeviceIDS(Context context) {
    TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String deviceId = telephonyManager.getDeviceId();
    if (TextUtils.isEmpty(deviceId)) {
      return true;
    }/*from  www.  j a  v a2s . c o m*/
    for (String knowdeviceid : kKNOWN_DEVICE_IDs) {
      if (knowdeviceid.equalsIgnoreCase(deviceId)) {
        return true;
      }
    }
    return false;
  }
}

Related Tutorials