Java 类android.provider.Settings.Secure 实例源码

项目:letv    文件:ccrccc.java   
private void b04390439й043904390439() {
    try {
        ContentResolver contentResolver = this.bььь044Cьь.getContentResolver();
        if (((b041EО041EО041EО() + b041E041EОО041EО) * b041EО041EО041EО()) % bОО041EО041EО != bО041EОО041EО) {
            b041EООО041EО = b041EО041EО041EО();
            bО041EОО041EО = b041EО041EО041EО();
        }
        try {
            this.bьь044Cььь = Secure.getString(contentResolver, "android_id");
        } catch (Exception e) {
            throw e;
        }
    } catch (Exception e2) {
        throw e2;
    }
}
项目:letv    文件:NotificationManagerCompat.java   
public static Set<String> getEnabledListenerPackages(Context context) {
    String enabledNotificationListeners = Secure.getString(context.getContentResolver(), SETTING_ENABLED_NOTIFICATION_LISTENERS);
    if (!(enabledNotificationListeners == null || enabledNotificationListeners.equals(sEnabledNotificationListeners))) {
        String[] components = enabledNotificationListeners.split(NetworkUtils.DELIMITER_COLON);
        Set<String> packageNames = new HashSet(components.length);
        for (String component : components) {
            ComponentName componentName = ComponentName.unflattenFromString(component);
            if (componentName != null) {
                packageNames.add(componentName.getPackageName());
            }
        }
        synchronized (sEnabledNotificationListenersLock) {
            sEnabledNotificationListenerPackages = packageNames;
            sEnabledNotificationListeners = enabledNotificationListeners;
        }
    }
    return sEnabledNotificationListenerPackages;
}
项目:amap    文件:MIP_DeviceInfoUtils.java   
/**
 * 获取deviceId
 * 
 * @param mContext
 * @return
 */
public static String getDeviceId(Context mContext)
{
    String deviceId = getIMEI(mContext);

    if (deviceId == null || deviceId.equals(""))
    {
        deviceId = Secure.getString(mContext.getContentResolver(), Secure.ANDROID_ID);
        if (deviceId == null || deviceId.equals("") || deviceId.equals("9774d56d682e549c"))
        {
            deviceId = "";
        }
    }

     return deviceId;
}
项目:amap    文件:MIP_SystemUtils.java   
/**
 * 获取手机设置状态 比如蓝牙开启与否
 * 
 * @return String
 */
public static String getPhoneSettings()
{
    StringBuffer buf = new StringBuffer();
    String str = Secure.getString(GlobalState.getInstance().getContentResolver(), Secure.BLUETOOTH_ON);
    buf.append("蓝牙:");
    if (str.equals("0"))
    {
        buf.append("禁用");
    }
    else
    {
        buf.append("开启");
    }
    //
    str = Secure.getString(GlobalState.getInstance().getContentResolver(), Secure.BLUETOOTH_ON);
    buf.append("WIFI:");
    buf.append(str);

    str = Secure.getString(GlobalState.getInstance().getContentResolver(), Secure.INSTALL_NON_MARKET_APPS);
    buf.append("APP位置来源:");
    buf.append(str);

    return buf.toString();
}
项目:CustomLogger    文件:NSLoggerClient.java   
void pushClientInfoToFrontOfQueue()
{
    if (DEBUG_LOGGER)
        Log.v("NSLogger", "Pushing client info to front of queue");

    LogMessage lm = new LogMessage(LogMessage.LOGMSG_TYPE_CLIENTINFO, nextSequenceNumber.getAndIncrement());
    lm.addString(Build.MANUFACTURER + " " + Build.MODEL, LogMessage.PART_KEY_CLIENT_MODEL);
    lm.addString("Android", LogMessage.PART_KEY_OS_NAME);
    lm.addString(Build.VERSION.RELEASE, LogMessage.PART_KEY_OS_VERSION);
    lm.addString(Secure.getString(currentContext.getContentResolver(), Secure.ANDROID_ID), LogMessage.PART_KEY_UNIQUEID);
    ApplicationInfo ai = currentContext.getApplicationInfo();
    String appName = ai.packageName;
    if (appName == null)
    {
        appName = ai.processName;
        if (appName == null)
        {
            appName = ai.taskAffinity;
            if (appName == null)
                appName = ai.toString();
        }
    }
    lm.addString(appName, LogMessage.PART_KEY_CLIENT_NAME);
    logs.add(0, lm);
    clientInfoAdded = true;
}
项目:boohee_v5.6    文件:f.java   
public static synchronized String c(Context context) {
    String str;
    synchronized (f.class) {
        if (c != null) {
            str = c;
        } else {
            String string;
            try {
                string = Secure.getString(context.getContentResolver(), "android_id");
            } catch (Throwable th) {
                b.a(th);
                string = null;
            }
            c = d.b(string + (VERSION.SDK_INT > 8 ? Build.SERIAL : null));
            str = c;
        }
    }
    return str;
}
项目:boohee_v5.6    文件:NotificationManagerCompat.java   
public static Set<String> getEnabledListenerPackages(Context context) {
    String enabledNotificationListeners = Secure.getString(context.getContentResolver(), SETTING_ENABLED_NOTIFICATION_LISTENERS);
    if (!(enabledNotificationListeners == null || enabledNotificationListeners.equals(sEnabledNotificationListeners))) {
        String[] components = enabledNotificationListeners.split(":");
        Set<String> packageNames = new HashSet(components.length);
        for (String component : components) {
            ComponentName componentName = ComponentName.unflattenFromString(component);
            if (componentName != null) {
                packageNames.add(componentName.getPackageName());
            }
        }
        synchronized (sEnabledNotificationListenersLock) {
            sEnabledNotificationListenerPackages = packageNames;
            sEnabledNotificationListeners = enabledNotificationListeners;
        }
    }
    return sEnabledNotificationListenerPackages;
}
项目:ooooim_android    文件:DeviceUtil.java   
/**
 * 获取手机的设备号或wifi的mac号
 *
 * @param context 上下文
 * @return 在wifi环境下只返回mac地址,否则返回手机设备号, 在模拟器情况下会返回null
 */
public static String getDeviceId(Context context) {
    WifiManager manager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
    WifiInfo wifiInfo = manager.getConnectionInfo();
    String macAddress = wifiInfo.getMacAddress();
    if (null != macAddress) {
        //          Log.d(Thread.currentThread().getName(), "mac:" + macAddress);
        return macAddress.replace(".", "").replace(":", "").replace("-", "").replace("_", "").replace("+", "").replace("-", "").replace("=", "");
    } else {
        TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        String imei = tm.getDeviceId();
        if (null != imei && !SPECIAL_IMEI.equals(imei)) {
            //              Log.d(Thread.currentThread().getName(), "imei:" + imei);
            return imei;
        } else {
            String deviceId = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
            if (null != deviceId) {
                //                  Log.d(Thread.currentThread().getName(), "ANDROID_ID:" + deviceId);
                return deviceId.replace("+", "").replace("-", "").replace("=", "");
            }
            return null;
        }
    }
}
项目:ShareWithMe    文件:LobbyActivity.java   
/**
 * Register hash for the device helper function.
 */
private void registerHash() {
    String hash = Secure.getString(this.getContentResolver(),
            Secure.ANDROID_ID);
    if (hash == null || hash == "") {
        hash = Long.toHexString(UUID.randomUUID().getLeastSignificantBits());
    }

    SharedPreferences preference = PreferenceManager
            .getDefaultSharedPreferences(this);
    String stored = preference.getString(
            Util.SHARED_PREFERENCE_INSTNCE_HASH_CODE_KEY, "");

    /*
     * Write only once in the first start of the application.
     */
    if (stored.equals("") == true) {
        SharedPreferences.Editor editor = preference.edit();
        editor.putString(Util.SHARED_PREFERENCE_INSTNCE_HASH_CODE_KEY, hash);
        editor.commit();
    }
}
项目:ProjectOxford-Apps-MimickerAlarm    文件:Logger.java   
public static void init(Context caller){
    sContext = caller;
    if (!sStarted && isLogging()) {
        String android_id = Secure.getString(caller.getContentResolver(), Secure.ANDROID_ID);
        try {

            sMixpanelToken = KeyUtilities.getToken(caller, "mixpanel");

            if (sMixpanelToken == null || sMixpanelToken.equals("")){
                sStarted = false;
                return;
            }

            sStarted = true;
            MixpanelAPI mixpanel = MixpanelAPI.getInstance(sContext, sMixpanelToken);
            mixpanel.identify(android_id);
            mixpanel.getPeople().identify(android_id);
            mixpanel.getPeople().set("name", android_id);
            mixpanel.getPeople().set("Build Version", BuildConfig.VERSION_NAME);
            mixpanel.getPeople().setMap(Collections.<String, Object>unmodifiableMap(mixpanel.getDeviceInfo()));
        }
        catch (Exception ex){
            trackException(ex);
        }
    }
}
项目:ShareWithUs    文件:LobbyActivity.java   
/**
 * Register hash for the device helper function.
 */
private void registerHash() {
    String hash = Secure.getString(this.getContentResolver(),
            Secure.ANDROID_ID);
    if (hash == null || hash == "") {
        hash = Long
                .toHexString(UUID.randomUUID().getLeastSignificantBits());
    }

    SharedPreferences preference = PreferenceManager
            .getDefaultSharedPreferences(this);
    String stored = preference.getString(
            Util.SHARED_PREFERENCE_INSTNCE_HASH_CODE_KEY, "");

    /*
     * Write only once in the first start of the application.
     */
    if (stored.equals("") == true) {
        SharedPreferences.Editor editor = preference.edit();
        editor.putString(Util.SHARED_PREFERENCE_INSTNCE_HASH_CODE_KEY, hash);
        editor.commit();
    }
}
项目:BigApp_Discuz_Android    文件:Tools.java   
public static String getDeviceId(Context context) {

        TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        if (tm == null) {
            return "0_0";
        }

        StringBuffer sb = new StringBuffer();
        String imei = tm.getDeviceId();
        sb.append(TextUtils.isEmpty(imei) ? "0" : imei);
        sb.append("_");

        String androidId = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
        sb.append(TextUtils.isEmpty(androidId) ? "0" : androidId);

        return sb.toString();
    }
项目:aibao_demo    文件:DeviceUtil.java   
/**
 * 获取手机的设备号或wifi的mac号
 *
 * @param context 上下文
 * @return 在wifi环境下只返回mac地址,否则返回手机设备号, 在模拟器情况下会返回null
 */
public static String getDeviceId(Context context) {
    WifiManager manager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
    WifiInfo wifiInfo = manager.getConnectionInfo();
    String macAddress = wifiInfo.getMacAddress();
    if (null != macAddress) {
        return macAddress.replace(".", "").replace(":", "").replace("-", "").replace("_", "").replace("+", "").replace("-", "").replace("=", "");
    } else {
        TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        String imei = tm.getDeviceId();
        if (StringUtil.isNotBlank(imei) && !SPECIAL_IMEI.equals(imei)) {
            return imei;
        } else {
            String deviceId = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
            if (null != deviceId) {
                return deviceId.replace("+", "").replace("-", "").replace("=", "");
            }
            return null;
        }
    }
}
项目:info_demo    文件:DeviceUtil.java   
/**
 * 获取手机的设备号或wifi的mac号
 *
 * @param context 上下文
 * @return 在wifi环境下只返回mac地址,否则返回手机设备号, 在模拟器情况下会返回null
 */
public static String getDeviceId(Context context) {
    WifiManager manager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
    WifiInfo wifiInfo = manager.getConnectionInfo();
    String macAddress = wifiInfo.getMacAddress();
    if (null != macAddress) {
        //          Log.d(Thread.currentThread().getName(), "mac:" + macAddress);
        return macAddress.replace(".", "").replace(":", "").replace("-", "").replace("_", "").replace("+", "").replace("-", "").replace("=", "");
    } else {
        TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        String imei = tm.getDeviceId();
        if (null != imei && !SPECIAL_IMEI.equals(imei)) {
            //              Log.d(Thread.currentThread().getName(), "imei:" + imei);
            return imei;
        } else {
            String deviceId = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
            if (null != deviceId) {
                //                  Log.d(Thread.currentThread().getName(), "ANDROID_ID:" + deviceId);
                return deviceId.replace("+", "").replace("-", "").replace("=", "");
            }
            return null;
        }
    }
}
项目:mapmap    文件:CaptureService.java   
@Override
  public void onCreate() {
      Log.i("CaptureService", "onCreate");

      appContext = this.getApplication();
      gpsNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

prefsManager = PreferenceManager.getDefaultSharedPreferences(this);


if(imei == null)
      {
        TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
        CaptureService.imei = telephonyManager.getDeviceId();

        // fall back to Secure.ANDROID_ID if IMEI isn't set -- continuing to use IMEI as primary ID mechanism for backwards compatibility
        if(CaptureService.imei == null || CaptureService.imei.length() == 0){
            CaptureService.imei = Secure.getString(getBaseContext().getContentResolver(),Secure.ANDROID_ID); 
        }
      }
  }
项目:Team9Project    文件:UserSettingsActivity.java   
/**
 * Finishes the activity and passes the {@link User} in the
 * result intent.
 */
private void save() {
    Intent intent = new Intent();
    String nameText = nameField.getText().toString();

    if (user == null) {
        String androidID = Secure.getString(getContentResolver(), Secure.ANDROID_ID); 
        user = new User(androidID, nameText);
    } else {
        user.setName(nameText);
    }
    user.setLocation(homeLocation);

    intent.putExtra(EXTRA_USER, user);
    setResult(RESULT_OK, intent);
    finish();
}
项目:FMTech    文件:efj.java   
public static boolean D(Context paramContext)
{
  int i1 = Build.VERSION.SDK_INT;
  boolean bool = false;
  ContentResolver localContentResolver;
  if (i1 >= 21) {
    localContentResolver = paramContext.getContentResolver();
  }
  try
  {
    int i2 = Settings.Secure.getInt(localContentResolver, "high_text_contrast_enabled");
    bool = false;
    if (i2 != 0) {
      bool = true;
    }
    return bool;
  }
  catch (Settings.SettingNotFoundException localSettingNotFoundException) {}
  return false;
}
项目:FMTech    文件:eg.java   
public static Set<String> a(Context paramContext)
{
  String str = Settings.Secure.getString(paramContext.getContentResolver(), "enabled_notification_listeners");
  HashSet localHashSet;
  if ((str != null) && (!str.equals(c)))
  {
    String[] arrayOfString = str.split(":");
    localHashSet = new HashSet(arrayOfString.length);
    int j = arrayOfString.length;
    for (int k = 0; k < j; k++)
    {
      ComponentName localComponentName = ComponentName.unflattenFromString(arrayOfString[k]);
      if (localComponentName != null) {
        localHashSet.add(localComponentName.getPackageName());
      }
    }
  }
  synchronized (b)
  {
    d = localHashSet;
    c = str;
    return d;
  }
}
项目:nightdream    文件:LocationService.java   
private boolean isLocationEnabled() {
    int locationMode = 0;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
        try {
            locationMode = Secure.getInt(mContext.getContentResolver(), Secure.LOCATION_MODE);

        } catch (SettingNotFoundException e) {
            e.printStackTrace();
        }

        return locationMode != Secure.LOCATION_MODE_OFF;

    } else {
        return isLocationEnabled_Deprecated();
    }
}
项目:EndUserInteractioion_RequestResponse_Command    文件:HardwareInfoProbe.java   
private JsonObject getData() {
    JsonObject data = new JsonObject();

    // shows error- why ??
    // data.addProperty(WIFI_MAC, ((WifiManager)
    // context.getSystemService(Context.WIFI_SERVICE)).getConnectionInfo().getMacAddress());

    // Shows - error - why???
    /*
     * String bluetoothMac = getBluetoothMac(); if (bluetoothMac != null) {
     * data.addProperty(BLUETOOTH_MAC, bluetoothMac); }
     */
    data.addProperty(ANDROID_ID,
            Secure.getString(this.getContentResolver(), Secure.ANDROID_ID));
    data.addProperty(BRAND, Build.BRAND);
    data.addProperty(MODEL, Build.MODEL);
    data.addProperty(MANUFACTURER, Build.MANUFACTURER);
    data.addProperty(HOST, Build.HOST);

    data.addProperty("DEVICE_TYPE", getDeviceType());

    // -Shows error - why?
    // data.addProperty(DEVICE_ID, ((TelephonyManager)
    // this.getSystemService(this.TELEPHONY_SERVICE)).getDeviceId());
    return data;
}
项目:AndroidAgent    文件:OCSAgentActivity.java   
private void importConfig() {
    String myPackName = getApplicationContext().getPackageName();
    String filePrefsName = myPackName + "_preferences.xml";
    String oldFilePrefsName = "org.ocsinventory.android.agent_preferences.xml";
    File repPrefs = Environment.getExternalStoragePublicDirectory("ocs");
    File ficPrefs = new File(repPrefs, filePrefsName);

    if (!ficPrefs.exists()) {
        ficPrefs = new File(repPrefs, oldFilePrefsName);
        if (!ficPrefs.exists()) {
            return;
        }
    }
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);

    PrefsParser pp = new PrefsParser();
    pp.parseDocument(ficPrefs, prefs);

    Date now = new Date();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.getDefault());
    String deviceUid = "android-" + Secure.getString(getContentResolver(), Secure.ANDROID_ID) + "-" + sdf.format(now);
    settings.setDeviceUid(deviceUid);

    Toast.makeText(this, getText(R.string.msg_conf_imported), Toast.LENGTH_SHORT).show();
    setStatus(R.string.msg_conf_imported);
}
项目:Moticons    文件:MainActivity.java   
@Override
protected void onStart() {
    super.onStart();
    if (!appPreferences.getDeviceID().equals(Secure.getString(context.getContentResolver(), Secure.ANDROID_ID))) {
        AlertDialog.Builder alertDialog = UtilsDialog.showDialog(context, "ಠ_ಠ", getResources().getString(R.string.dialog_wrong_id_description));
        alertDialog.setPositiveButton(android.R.string.ok + "..." + " (>_<)", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                appPreferences.setMoticoins(0);
                appPreferences.setMoticonUnlocked(new HashSet<String>());
                appPreferences.setUnlockAllMoticons(false);
                appPreferences.setRemoveAds(false);
                updateMoticoins(context);
                dialogInterface.dismiss();
            }
        });

        alertDialog.show();
    }
}
项目:ProjectOxford-Apps-MimickerAlarm    文件:Logger.java   
public static void init(Context caller){
    sContext = caller;
    if (!sStarted && isLogging()) {
        String android_id = Secure.getString(caller.getContentResolver(), Secure.ANDROID_ID);
        try {

            sMixpanelToken = KeyUtilities.getToken(caller, "mixpanel");

            if (sMixpanelToken == null || sMixpanelToken.equals("")){
                sStarted = false;
                return;
            }

            sStarted = true;
            MixpanelAPI mixpanel = MixpanelAPI.getInstance(sContext, sMixpanelToken);
            mixpanel.identify(android_id);
            mixpanel.getPeople().identify(android_id);
            mixpanel.getPeople().set("name", android_id);
            mixpanel.getPeople().set("Build Version", BuildConfig.VERSION_NAME);
            mixpanel.getPeople().setMap(Collections.<String, Object>unmodifiableMap(mixpanel.getDeviceInfo()));
        }
        catch (Exception ex){
            trackException(ex);
        }
    }
}
项目:talkback    文件:FailoverTextToSpeech.java   
public FailoverTextToSpeech(Context context) {
    mContext = context;
    mContext.registerReceiver(mMediaStateMonitor, mMediaStateMonitor.getFilter());

    final Uri defaultSynth = Secure.getUriFor(Secure.TTS_DEFAULT_SYNTH);
    final Uri defaultPitch = Secure.getUriFor(Secure.TTS_DEFAULT_PITCH);
    final Uri defaultRate = Secure.getUriFor(Secure.TTS_DEFAULT_RATE);

    mResolver = context.getContentResolver();
    mResolver.registerContentObserver(defaultSynth, false, mSynthObserver);
    mResolver.registerContentObserver(defaultPitch, false, mPitchObserver);
    mResolver.registerContentObserver(defaultRate, false, mRateObserver);

    registerGoogleTtsFixCallbacks();

    updateDefaultPitch();
    updateDefaultRate();

    // Updating the default engine reloads the list of installed engines and
    // the system engine. This also loads the default engine.
    updateDefaultEngine();
}
项目:talkback    文件:FailoverTextToSpeech.java   
public void updateDefaultEngine() {
    final ContentResolver resolver = mContext.getContentResolver();

    // Always refresh the list of available engines, since the user may have
    // installed a new TTS and then switched to it.
    mInstalledTtsEngines.clear();
    mSystemTtsEngine = TextToSpeechUtils.reloadInstalledTtsEngines(
            mContext.getPackageManager(), mInstalledTtsEngines);

    // This may be null if the user hasn't specified an engine.
    mDefaultTtsEngine = Secure.getString(resolver, Secure.TTS_DEFAULT_SYNTH);

    // Switch engines when the system default changes and it's not the current engine.
    if (mTtsEngine == null || !mTtsEngine.equals(mDefaultTtsEngine)) {
        if (mInstalledTtsEngines.contains(mDefaultTtsEngine)) {
            // Can load the default engine.
            setTtsEngine(mDefaultTtsEngine, true);
        } else if (!mInstalledTtsEngines.isEmpty()) {
            // We'll take whatever TTS we can get.
            setTtsEngine(mInstalledTtsEngines.get(0), true);
        }
    }
}
项目:ApkAutoInstaller    文件:InstallerUtils.java   
public static boolean isEnableAutoInstall() {
    Context mContext = AutoInstallerContext.getContext();
    SimpleStringSplitter simpleStringSplitter = new SimpleStringSplitter(':');
    if (!SettingsUtil.isAccessibiltiyEnable(mContext)) {
        return false;
    }
    String string = Secure.getString(mContext.getContentResolver(), "enabled_accessibility_services");
    if (string == null) {
        return false;
    }
    simpleStringSplitter.setString(string);
    while (simpleStringSplitter.hasNext()) {
        if (simpleStringSplitter.next().equalsIgnoreCase(
                AutoInstallerContext.getTargetService())) {
            return true;
        }
    }
    return false;
}
项目:tinytimetracker    文件:TinyTimeTracker.java   
public static boolean isLocationEnabled(Context context) {
    int locationMode = 0;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        try {
            locationMode = Secure.getInt(context.getContentResolver(), Secure.LOCATION_MODE);

        } catch (SettingNotFoundException e) {
            e.printStackTrace();
        }

        return locationMode != Secure.LOCATION_MODE_OFF;

    } else {
        String locationProviders = Secure.getString(context.getContentResolver(),
                Secure.LOCATION_PROVIDERS_ALLOWED);
        return !locationProviders.isEmpty();
    }
}
项目:topodroid    文件:TDLevel.java   
static void setLevel( Context ctx, int level )
{
  mLevel = level;
  overBasic    = mLevel > BASIC;
  overNormal   = mLevel > NORMAL;
  overAdvanced = mLevel > ADVANCED;
  overExpert   = mLevel > EXPERT;
  // overTester  = mLevel > TESTER;
  if ( overExpert ) {
    String android_id = Secure.getString( ctx.getContentResolver(), Secure.ANDROID_ID );
    // Log.v("DistoX", "android_id <" + android_id + ">");
    if ( // "e5582eda21cafac3".equals( android_id ) || // Nexus-4
         "8c894b79b6dce351".equals( android_id ) ) {   // Samsung Note-3
      overTester = true;
    }
  }
}
项目:CouldBooks    文件:NetWorkUtils.java   
/**
 * 获取设备�?
 * 
 * @param context
 *            上下�?
 * @return
 */
public static String getDiviceNo(Context context) {
    // TelephonyManager提供设备上获取�?讯服务信息的入口
    TelephonyManager telephonyManager = null;
    // 获取手机管理对象
    telephonyManager = (TelephonyManager) context
            .getSystemService(Context.TELEPHONY_SERVICE);
    // 设备标号
    String diviceNo = telephonyManager.getDeviceId();
    if (diviceNo == null || diviceNo.length() <= 0) {
        // 如果设备号获取不�?就获取安卓设备标�?
        diviceNo = Secure.getString(context.getContentResolver(),
                Secure.ANDROID_ID);
    }
    return diviceNo;
}
项目:EasyLinkNJ    文件:DeviceUtil.java   
public static String getIMEI() {

    String imei = "";
    try{

        Context ctx = ExApplication.getContext();
        TelephonyManager telephonyManager = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE);
        if (telephonyManager != null) {

            imei = telephonyManager.getDeviceId();
            if (TextUtils.isEmpty(imei))
                imei = Secure.getString(ctx.getContentResolver(), Secure.ANDROID_ID);

            if(imei == null)
                imei = "";
        }

    }catch(Exception e){

        if(LogMgr.isDebug())
            e.printStackTrace();
    }

    return imei;
}
项目:KLocationTracker    文件:KTrackerMainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Context context=KTrackerMainActivity.this;
    intent=new Intent(context, KTrackerServices.class);
    pintentIntent=PendingIntent.getService(context, 0, intent, 0); 
    alarmManager=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
    cal=Calendar.getInstance();
    cal.setTimeInMillis(System.currentTimeMillis());
    KTrackerConfiguration.androidDeviceID=Secure.getString(getContentResolver(), Secure.ANDROID_ID);
    createAlarm();  

    tv=(TextView)findViewById(R.id.locationData);
    //tv.setText("Hiiii");

}
项目:Team5GeoTopics    文件:UserIO.java   
/**
 * Writes the user class out to disk. This is used to store the users
 * profile locally such that it can be retrieved without Internet if needed.
 */
public void writeUser(User user, boolean ioDisabled) {
    user.setmID(Secure.getString(mContext
            .getContentResolver(), Secure.ANDROID_ID));
    Gson gson;
    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(Bitmap.class, new BitmapJsonConverter());
    gson = builder.create();

    if (!ioDisabled) {
        try {
            FileOutputStream fos = mContext
                    .openFileOutput(USER, Context.MODE_PRIVATE);
            OutputStreamWriter osw = new OutputStreamWriter(fos);
            Log.w("User", gson.toJson(this));
            gson.toJson(user, osw);
            osw.flush();
            osw.close();
            Log.w("User", "Saved: " + USER);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
项目:Team5GeoTopics    文件:User.java   
private User() {
    mBookMarks = new ArrayList<String>();
    mFavourites = new ArrayList<String>();
    mComments = new ArrayList<String>();
    this.mID = Secure.getString(userLocation.getContext()
            .getContentResolver(), Secure.ANDROID_ID);
    setUserName("Anonymous");
    webConnectionReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            if (userLocation.isNetworkAvailable() && needUpdate == true) {
                Log.w("Connectivity", "Pushing profile update");
                syncUser();
                needUpdate = false;
            }
        }
    };
    userLocation.getContext().registerReceiver(webConnectionReceiver,
            new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
}
项目:PasswordLogin    文件:DeviceInfo.java   
/**
 * 
 * @param context
 * @return
 */
public static final String getDeviceId(Context context) {
    String id = Settings.Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
    String device = Build.DEVICE;
    id = device + id;
    MessageDigest md = null;
    try {
        md = MessageDigest.getInstance("SHA1");
        byte[] bytes = id.getBytes("UTF-8");
        md.update(bytes, 0, bytes.length);

        return HexCoder.toHex(md.digest());
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
项目:EasyRestClient    文件:EasyCommonUtils.java   
private static String generateID(Context context) {
    // use the ANDROID_ID constant, generated at the first device boot
    String deviceId = Secure.getString(context.getContentResolver(),
            Secure.ANDROID_ID);
    // in case known problems are occured
    if (deviceId == null) {
        // get a unique deviceID like IMEI for GSM or ESN for CDMA phones
        // don't forget:
        // <uses-permission
        // android:name="android.permission.READ_PHONE_STATE" />
        deviceId = ((TelephonyManager) context
                .getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();

        // if nothing else works, generate a random number
        if (deviceId == null) {
            Random tmpRand = new Random();
            deviceId = String.valueOf(tmpRand.nextLong());
        }
    }
    // any value is hashed to have consistent format
    return getHash(deviceId);
}
项目:itmarry    文件:DeviceUtil.java   
public static Map<String, String> getDeviceData(Context context) {
    Map<String, String> m = new HashMap<String, String>();
    String tmDevice = "", tmSerial = "", androidId = "";
    UUID deviceUuid = UUID.randomUUID();
    try {
        final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        tmDevice = String.valueOf(tm.getDeviceId());
        tmSerial = String.valueOf(tm.getSimSerialNumber());
        androidId = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
        deviceUuid = new UUID(androidId.hashCode(), ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode());
    } catch (Exception e) {
        Log.e(tag, "TelephonyManager error.", e);
    }
    m.put("device", tmDevice);
    m.put("serial", tmSerial);
    m.put("androidId", androidId);
    m.put("deviceUuid", deviceUuid.toString());
    return m;
}
项目:itmarry    文件:DeviceUtil.java   
public static String getSimpleDeviceId(Context context) {
    TelephonyManager tManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String result = tManager.getDeviceId();
    if (!TextUtils.isEmpty(result)) {
        return result;
    }
    try {
        result = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
    } catch (Exception e) {
        Log.e(tag, "Secure error.", e);
    }
    if (!TextUtils.isEmpty(result)) {
        return result;
    }
    result = UUID.randomUUID().toString();
    return result;
}
项目:itmarry    文件:DeviceUtil.java   
public static Map<String, String> getDeviceData(Context context) {
    Map<String, String> m = new HashMap<String, String>();
    String tmDevice = "", tmSerial = "", androidId = "";
    UUID deviceUuid = UUID.randomUUID();
    try {
        final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        tmDevice = String.valueOf(tm.getDeviceId());
        tmSerial = String.valueOf(tm.getSimSerialNumber());
        androidId = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
        deviceUuid = new UUID(androidId.hashCode(), ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode());
    } catch (Exception e) {
        Log.e(tag, "TelephonyManager error.", e);
    }
    m.put("device", tmDevice);
    m.put("serial", tmSerial);
    m.put("androidId", androidId);
    m.put("deviceUuid", deviceUuid.toString());
    return m;
}
项目:itmarry    文件:DeviceUtil.java   
public static String getSimpleDeviceId(Context context) {
    TelephonyManager tManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String result = tManager.getDeviceId();
    if (!TextUtils.isEmpty(result)) {
        return result;
    }
    try {
        result = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
    } catch (Exception e) {
        Log.e(tag, "Secure error.", e);
    }
    if (!TextUtils.isEmpty(result)) {
        return result;
    }
    result = UUID.randomUUID().toString();
    return result;
}
项目:itmarry    文件:DeviceUtil.java   
public static Map<String, String> getDeviceData(Context context) {
    Map<String, String> m = new HashMap<String, String>();
    String tmDevice = "", tmSerial = "", androidId = "";
    UUID deviceUuid = UUID.randomUUID();
    try {
        final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        tmDevice = String.valueOf(tm.getDeviceId());
        tmSerial = String.valueOf(tm.getSimSerialNumber());
        androidId = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
        deviceUuid = new UUID(androidId.hashCode(), ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode());
    } catch (Exception e) {
        Log.e(tag, "TelephonyManager error.", e);
    }
    m.put("device", tmDevice);
    m.put("serial", tmSerial);
    m.put("androidId", androidId);
    m.put("deviceUuid", deviceUuid.toString());
    return m;
}