当前位置: 首页>>代码示例>>Java>>正文


Java Settings.SettingNotFoundException方法代码示例

本文整理汇总了Java中android.provider.Settings.SettingNotFoundException方法的典型用法代码示例。如果您正苦于以下问题:Java Settings.SettingNotFoundException方法的具体用法?Java Settings.SettingNotFoundException怎么用?Java Settings.SettingNotFoundException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.provider.Settings的用法示例。


在下文中一共展示了Settings.SettingNotFoundException方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isSignInServiceEnabled

import android.provider.Settings; //导入方法依赖的package包/类
public static boolean isSignInServiceEnabled(Context context) {
    int accessibilityEnabled = 0;
    try {
        accessibilityEnabled = Settings.Secure.getInt(context.getContentResolver(),
                android.provider.Settings.Secure.ACCESSIBILITY_ENABLED);
    } catch (Settings.SettingNotFoundException e) {
        e.printStackTrace();
    }

    if (accessibilityEnabled == 1) {
        // get all the enabled service name, like:
        // com.pyy.signin/com.pyy.signin.SignInService:com.baidu.appsearch/com.baidu.appsearch.util.AppAccessibilityService
        String services = Settings.Secure.getString(context.getContentResolver(),
                Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
        if (services != null) {
            // Check the enabled service is the same one with this app.
            return services.toLowerCase().contains(context.getPackageName().toLowerCase());
        }
    }

    return false;
}
 
开发者ID:Sl0v3C,项目名称:Android_AutoSignInTool,代码行数:23,代码来源:Utils.java

示例2: isAccessibilitySettingsOn

import android.provider.Settings; //导入方法依赖的package包/类
private boolean isAccessibilitySettingsOn() {
    int accessibilityEnabled = 0;
    final String service = getPackageName() + "/" + NotificationService.class.getName();
    boolean accessibilityFound = false;
    try {
        accessibilityEnabled = Settings.Secure.getInt(getApplicationContext().getContentResolver(), android.provider.Settings.Secure.ACCESSIBILITY_ENABLED);
    } catch (Settings.SettingNotFoundException e) {
    }
    TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':');
    if (accessibilityEnabled == 1) {
        String settingValue = Settings.Secure.getString(getApplicationContext().getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
        if (settingValue != null) {
            TextUtils.SimpleStringSplitter splitter = mStringColonSplitter;
            splitter.setString(settingValue);
            while (splitter.hasNext()) {
                String accessabilityService = splitter.next();
                if (accessabilityService.equalsIgnoreCase(service)) {
                    return true;
                }
            }
        }
    } else {
    }

    return accessibilityFound;
}
 
开发者ID:android-notes,项目名称:sao,代码行数:27,代码来源:MainActivity.java

示例3: checkAccessibilityEnabled

import android.provider.Settings; //导入方法依赖的package包/类
/**
 * 检测当前辅助服务是否开启
 */
public static boolean checkAccessibilityEnabled(Context context,Class<? extends AccessibilityService> clazz) {
    int accessibilityEnabled = 0;
    final String service = context.getPackageName() + "/" + clazz.getCanonicalName();
    try {
        accessibilityEnabled = Settings.Secure.getInt(context.getApplicationContext().getContentResolver(),Settings.Secure.ACCESSIBILITY_ENABLED);
    } catch (Settings.SettingNotFoundException ignored) {
        // ignored
    }
    TextUtils.SimpleStringSplitter stringColonSplitter = new TextUtils.SimpleStringSplitter(':');
    if (accessibilityEnabled == 1) {
        String settingValue = Settings.Secure.getString(context.getApplicationContext().getContentResolver(),Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
        if (settingValue != null) {
            stringColonSplitter.setString(settingValue);
            while (stringColonSplitter.hasNext()) {
                String accessibilityService = stringColonSplitter.next();
                if (accessibilityService.equalsIgnoreCase(service)) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:27,代码来源:AceHelper.java

示例4: isAccessibilitySettingsOn

import android.provider.Settings; //导入方法依赖的package包/类
private boolean isAccessibilitySettingsOn(Context mContext) {
    int accessibilityEnabled = 0;
    final String service = getPackageName() + "/" + JumpService.class.getCanonicalName();
    try {
        accessibilityEnabled = Settings.Secure.getInt(
                mContext.getApplicationContext().getContentResolver(),
                android.provider.Settings.Secure.ACCESSIBILITY_ENABLED);
        log.v( "accessibilityEnabled = " + accessibilityEnabled);
    } catch (Settings.SettingNotFoundException e) {
        log.d( "Error finding setting, default accessibility to not found: "
                + e.getMessage());
    }
    TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':');

    if (accessibilityEnabled == 1) {
        log.v( "***ACCESSIBILITY IS ENABLED*** -----------------");
        String settingValue = Settings.Secure.getString(
                mContext.getApplicationContext().getContentResolver(),
                Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
        if (settingValue != null) {
            mStringColonSplitter.setString(settingValue);
            while (mStringColonSplitter.hasNext()) {
                String accessibilityService = mStringColonSplitter.next();

                log.v( "-------------- > accessibilityService :: " + accessibilityService + " " + service);
                if (accessibilityService.equalsIgnoreCase(service)) {
                    log.v( "We've found the correct setting - accessibility is switched on!");
                    return true;
                }
            }
        }
    } else {
        log.v( "***ACCESSIBILITY IS DISABLED***");
    }

    return false;
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:38,代码来源:JumpService.java

示例5: isAccessibilitySettingsOn

import android.provider.Settings; //导入方法依赖的package包/类
private boolean isAccessibilitySettingsOn(Context mContext) {
    int accessibilityEnabled = 0;
    final String service = getPackageName() + "/" + HelpService.class.getCanonicalName();
    try {
        accessibilityEnabled = Settings.Secure.getInt(
                mContext.getApplicationContext().getContentResolver(),
                android.provider.Settings.Secure.ACCESSIBILITY_ENABLED);
        Log.v(TAG, "accessibilityEnabled = " + accessibilityEnabled);
    } catch (Settings.SettingNotFoundException e) {
        Log.e(TAG, "Error finding setting, default accessibility to not found: "
                + e.getMessage());
    }
    TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':');

    if (accessibilityEnabled == 1) {
        Log.v(TAG, "***ACCESSIBILITY IS ENABLED*** -----------------");
        String settingValue = Settings.Secure.getString(
                mContext.getApplicationContext().getContentResolver(),
                Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
        if (settingValue != null) {
            mStringColonSplitter.setString(settingValue);
            while (mStringColonSplitter.hasNext()) {
                String accessibilityService = mStringColonSplitter.next();

                Log.v(TAG, "-------------- > accessibilityService :: " + accessibilityService + " " + service);
                if (accessibilityService.equalsIgnoreCase(service)) {
                    Log.v(TAG, "We've found the correct setting - accessibility is switched on!");
                    return true;
                }
            }
        }
    } else {
        Log.v(TAG, "***ACCESSIBILITY IS DISABLED***");
    }

    return false;
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:38,代码来源:ForceStopActivity.java

示例6: refresh

import android.provider.Settings; //导入方法依赖的package包/类
public void refresh() {
    int enabled = 0;
    try {
        enabled = Settings.System.getInt(getContentResolver(), "pointer_location");
    } catch (Settings.SettingNotFoundException e) {
        e.printStackTrace();
    }
    getQsTile().setState(enabled == 1 ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
    getQsTile().updateTile();
}
 
开发者ID:XuDaojie,项目名称:DeveloperSettings,代码行数:11,代码来源:DeveloperTiles.java

示例7: getSleepDuration

import android.provider.Settings; //导入方法依赖的package包/类
/**
 * 获取进入休眠时长
 *
 * @return 进入休眠时长,报错返回-123
 */
public static int getSleepDuration() {
    try {
        return Settings.System.getInt(Utils.getApp().getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT);
    } catch (Settings.SettingNotFoundException e) {
        e.printStackTrace();
        return -123;
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:ScreenUtils.java

示例8: isAccessibilitySettingsOn

import android.provider.Settings; //导入方法依赖的package包/类
/**
 * Checks if the Forge Auto fill accessibility service is enabled
 *
 * @param context application context
 * @return true = service enabled, false = service disabled
 */
public static boolean isAccessibilitySettingsOn(Context context) {
    int accessibilityEnabled = 0;
    final String service = context.getPackageName() + "/" + AccessibilityAutofillService.class.getCanonicalName();
    try {
        accessibilityEnabled = Settings.Secure.getInt(
                context.getApplicationContext().getContentResolver(),
                android.provider.Settings.Secure.ACCESSIBILITY_ENABLED);
    } catch (Settings.SettingNotFoundException e) {
        // If there is an error, log it
        Log.e(Forge.ERROR_LOG, e.getMessage());
    }
    TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':');

    if (accessibilityEnabled == 1) {
        String settingValue = Settings.Secure.getString(
                context.getApplicationContext().getContentResolver(),
                Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
        if (settingValue != null) {
            mStringColonSplitter.setString(settingValue);
            while (mStringColonSplitter.hasNext()) {
                String accessibilityService = mStringColonSplitter.next();

                if (accessibilityService.equalsIgnoreCase(service)) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
开发者ID:jthomperoo,项目名称:Forge,代码行数:37,代码来源:Util.java

示例9: get

import android.provider.Settings; //导入方法依赖的package包/类
public static int get(Context context) {
    ContentResolver cResolver = context.getContentResolver();
    try {
        return Settings.System.getInt(cResolver, Settings.System.SCREEN_BRIGHTNESS);
    } catch (Settings.SettingNotFoundException e) {
        return 0;
    }
}
 
开发者ID:karanvs,项目名称:ExVidPlayer,代码行数:9,代码来源:BrightnessUtils.java

示例10: isAutoBrightness

import android.provider.Settings; //导入方法依赖的package包/类
/**
 * 判断是否开启了自动亮度调节
 */
public static boolean isAutoBrightness(Activity activity) {
    boolean isAuto = false;
    try {
        isAuto = Settings.System.getInt(activity.getContentResolver(),
                Settings.System.SCREEN_BRIGHTNESS_MODE) == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
    } catch (Settings.SettingNotFoundException e){
        e.printStackTrace();
    }
    return isAuto;
}
 
开发者ID:newbiechen1024,项目名称:NovelReader,代码行数:14,代码来源:BrightnessUtils.java

示例11: isAirplaneEnabled

import android.provider.Settings; //导入方法依赖的package包/类
@ReactMethod
public void isAirplaneEnabled(Promise promise) {
    try {
        int val =  Settings.System.getInt(getReactApplicationContext().getContentResolver(), Settings.System.AIRPLANE_MODE_ON);
        promise.resolve(val == 1);
    } catch (Settings.SettingNotFoundException e) {
        e.printStackTrace();
        promise.reject("-1", "get airplane mode fail", e);
    }
}
 
开发者ID:c19354837,项目名称:react-native-system-setting,代码行数:11,代码来源:SystemSetting.java

示例12: isAccessibilitySettingsOn

import android.provider.Settings; //导入方法依赖的package包/类
private boolean isAccessibilitySettingsOn(Context mContext) {
    int accessibilityEnabled = 0;
    final String service = getPackageName() + "/" + getPackageName() + ".MyService";
    boolean accessibilityFound = false;
    try {
        accessibilityEnabled = Settings.Secure.getInt(
                mContext.getApplicationContext().getContentResolver(),
                Settings.Secure.ACCESSIBILITY_ENABLED);
        Log.v("MainActivity","accessibilityEnabled = " + accessibilityEnabled);
    } catch (Settings.SettingNotFoundException e) {
        Log.e("MainActivity","Error finding setting, default accessibility to not found: "
                + e.getMessage());
    }
    TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':');

    if (accessibilityEnabled == 1) {
        Log.v("MainActivity","***ACCESSIBILIY IS ENABLED*** -----------------");
        String settingValue = Settings.Secure.getString(
                mContext.getApplicationContext().getContentResolver(),
                Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
        if (settingValue != null) {
            TextUtils.SimpleStringSplitter splitter = mStringColonSplitter;
            splitter.setString(settingValue);
            while (splitter.hasNext()) {
                String accessabilityService = splitter.next();

                Log.v("MainActivity","-------------- > accessabilityService :: " + accessabilityService);
                if (accessabilityService.equalsIgnoreCase(service)) {
                    Log.v("MainActivity","We've found the correct setting - accessibility is switched on!");
                    return true;
                }
            }
        }
    } else {
        Log.v("MainActivity","***ACCESSIBILIY IS DISABLED***");
    }
    return accessibilityFound;
}
 
开发者ID:paozhuanyinyu,项目名称:FreshMember,代码行数:39,代码来源:MainActivity.java

示例13: setBrightness

import android.provider.Settings; //导入方法依赖的package包/类
public void setBrightness(float value) {
    int screenMode = 0;
    try {
        screenMode = Settings.System.getInt(mContext.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE);
    } catch (Settings.SettingNotFoundException e) {
        e.printStackTrace();
    }

    if(screenMode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC){
        setScreenMode(Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
    }

    Settings.System.putInt(mContext.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, (int) value*255);
}
 
开发者ID:natjs,项目名称:nat-device-screen,代码行数:15,代码来源:ScreenModule.java

示例14: installingFromUnknownSourcesAllowed

import android.provider.Settings; //导入方法依赖的package包/类
/**
 * Returns whether the user has enabled installing apps from sources other than the Google Play
 * Store.
 */
private static boolean installingFromUnknownSourcesAllowed(Context context) {
    try {
        return Settings.Secure.getInt(
                       context.getContentResolver(), Settings.Secure.INSTALL_NON_MARKET_APPS)
                == 1;
    } catch (Settings.SettingNotFoundException e) {
        return false;
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:14,代码来源:ChromeWebApkHost.java

示例15: setBrightness

import android.provider.Settings; //导入方法依赖的package包/类
public void setBrightness(float value) {
    int screenMode = 0;
    try {
        screenMode = Settings.System.getInt(mWXSDKInstance.getContext().getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE);
    } catch (Settings.SettingNotFoundException e) {
        e.printStackTrace();
    }

    if(screenMode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC){
        setScreenMode(Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
    }

    Settings.System.putInt(mWXSDKInstance.getContext().getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, (int) (value * 255));
}
 
开发者ID:natjs,项目名称:nat-explorer,代码行数:15,代码来源:DeviceScreen.java


注:本文中的android.provider.Settings.SettingNotFoundException方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。