本文整理汇总了Java中android.provider.Settings.Secure类的典型用法代码示例。如果您正苦于以下问题:Java Secure类的具体用法?Java Secure怎么用?Java Secure使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Secure类属于android.provider.Settings包,在下文中一共展示了Secure类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: if
import android.provider.Settings.Secure; //导入依赖的package包/类
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;
}
}
示例2: getEnabledListenerPackages
import android.provider.Settings.Secure; //导入依赖的package包/类
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;
}
示例3: getDeviceId
import android.provider.Settings.Secure; //导入依赖的package包/类
/**
* 获取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;
}
示例4: getPhoneSettings
import android.provider.Settings.Secure; //导入依赖的package包/类
/**
* 获取手机设置状态 比如蓝牙开启与否
*
* @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();
}
示例5: pushClientInfoToFrontOfQueue
import android.provider.Settings.Secure; //导入依赖的package包/类
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;
}
示例6: c
import android.provider.Settings.Secure; //导入依赖的package包/类
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;
}
示例7: getEnabledListenerPackages
import android.provider.Settings.Secure; //导入依赖的package包/类
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;
}
示例8: getDeviceId
import android.provider.Settings.Secure; //导入依赖的package包/类
/**
* 获取手机的设备号或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;
}
}
}
示例9: registerHash
import android.provider.Settings.Secure; //导入依赖的package包/类
/**
* 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();
}
}
示例10: init
import android.provider.Settings.Secure; //导入依赖的package包/类
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);
}
}
}
示例11: registerHash
import android.provider.Settings.Secure; //导入依赖的package包/类
/**
* 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();
}
}
示例12: getDeviceId
import android.provider.Settings.Secure; //导入依赖的package包/类
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();
}
示例13: getDeviceId
import android.provider.Settings.Secure; //导入依赖的package包/类
/**
* 获取手机的设备号或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;
}
}
}
示例14: onCreate
import android.provider.Settings.Secure; //导入依赖的package包/类
@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);
}
}
}
示例15: save
import android.provider.Settings.Secure; //导入依赖的package包/类
/**
* 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();
}