Java Code Examples for com.crashlytics.android.Crashlytics#setBool()

The following examples show how to use com.crashlytics.android.Crashlytics#setBool() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PermissionUtils.java    From prayer-times-android with Apache License 2.0 6 votes vote down vote up
private void checkPermissions(@NonNull Context c) {
    pCalendar = ContextCompat.checkSelfPermission(c, Manifest.permission.WRITE_CALENDAR) == PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(c, Manifest.permission.READ_CALENDAR) == PackageManager.PERMISSION_GRANTED;
    pStorage = ContextCompat.checkSelfPermission(c, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(c, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
    pLocation = ContextCompat.checkSelfPermission(c, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        NotificationManager nm = (NotificationManager) c.getSystemService(Context.NOTIFICATION_SERVICE);
        pNotPolicy = nm.isNotificationPolicyAccessGranted();
        Crashlytics.setBool("pNotPolicy", pLocation);
    } else
        pNotPolicy = true;

    Crashlytics.setBool("pCalendar", pCalendar);
    Crashlytics.setBool("pStorage", pStorage);
    Crashlytics.setBool("pLocation", pLocation);
    Crashlytics.setBool("pNotPolicy", pNotPolicy);

}
 
Example 2
Source File: CustomHandlerCrashlytics.java    From ExceptionWear with Apache License 2.0 6 votes vote down vote up
@Override
/**
 * Exception handler with Crashlytics support, also it will be shown in logcat.
 */
public void handleException(Throwable throwable, DataMap map) {
    //Remember to init Crashlytics in your Application class.
    Crashlytics.setBool("wear_exception", true);
    Crashlytics.setString("board", map.getString("board"));
    Crashlytics.setString("fingerprint", map.getString("fingerprint"));
    Crashlytics.setString("model", map.getString("model"));
    Crashlytics.setString("manufacturer", map.getString("manufacturer"));
    Crashlytics.setString("product", map.getString("product"));
    Crashlytics.setString("api_level", map.getString("api_level"));

    Crashlytics.logException(throwable);

    Log.e(TAG, "Received exception from Wear" + throwable.getMessage()
            + ", manufacturer: " + map.getString("manufacturer")
            + ", model: " + map.getString("model")
            + ", product: " + map.getString("product")
            + ", fingerprint: " + map.getString("fingerprint")
            + ", api_level: " + map.getString("api_level")
            + ", stack trace: " + Log.getStackTraceString(throwable));
}
 
Example 3
Source File: PermissionUtils.java    From prayer-times-android with Apache License 2.0 6 votes vote down vote up
private void checkPermissions(@NonNull Context c) {
    pCalendar = ContextCompat.checkSelfPermission(c, Manifest.permission.WRITE_CALENDAR) == PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(c, Manifest.permission.READ_CALENDAR) == PackageManager.PERMISSION_GRANTED;
    pStorage = ContextCompat.checkSelfPermission(c, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(c, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
    pLocation = ContextCompat.checkSelfPermission(c, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        NotificationManager nm = (NotificationManager) c.getSystemService(Context.NOTIFICATION_SERVICE);
        pNotPolicy = nm.isNotificationPolicyAccessGranted();
        Crashlytics.setBool("pNotPolicy", pLocation);
    } else
        pNotPolicy = true;

    Crashlytics.setBool("pCalendar", pCalendar);
    Crashlytics.setBool("pStorage", pStorage);
    Crashlytics.setBool("pLocation", pLocation);
    Crashlytics.setBool("pNotPolicy", pNotPolicy);

}
 
Example 4
Source File: CrashReport.java    From rebootmenu with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 开始错误报告
 * 逻辑:如果自动上传配置为假,自动捕捉,否则不做处理(由Crashlytics捕捉)
 *
 * @param context {@link Context}
 * @param handler {@link java.lang.Thread.UncaughtExceptionHandler}
 */
public static void start(Context context, Thread.UncaughtExceptionHandler handler) {
    long launchTimes = ConfigManager.getPrivateLong(context, ConfigManager.APP_LAUNCH_TIMES, 0);
    /*
     * 第一条件:用户不是一般用户 -> !(安装了酷安,是MIUI系统)
     * 第二条件:自动上报功能关闭,或条件不足以加载csc
     */
    if (!CoolapkCompat.hasCoolapk(context) && !SpecialSupport.isMIUI()) {
        if (!ConfigManager.getPrivateBoolean(context, ConfigManager.AUTO_CRASH_REPORT, false) || !MainCompat.shouldLoadCSC())
            Thread.setDefaultUncaughtExceptionHandler(handler);
    } else {
        //Firebase Crashlytics抓取的机型信息不全面,这里再手动抓一次
        try {
            JSONObject object = new JSONObject(SendBugFeedback.getRawBuildEnvInfo());
            Iterator iterator = object.keys();
            while (iterator.hasNext()) {
                String key = (String) iterator.next();
                Crashlytics.setString(key, object.getString(key));
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        Crashlytics.setLong("launchTimes", launchTimes);
        //小米设备的话看看是不是原版系统
        if ("Xiaomi".equals(Build.MANUFACTURER))
            Crashlytics.setBool("isMIUI", SpecialSupport.isMIUI());
        Crashlytics.setString("serviceAvailableState", GmsApiWrapper.fetchStateString(context));
    }
    ConfigManager.setPrivateLong(context, ConfigManager.APP_LAUNCH_TIMES, ++launchTimes);
}
 
Example 5
Source File: App.java    From prayer-times-android with Apache License 2.0 5 votes vote down vote up
@Override
public void uncaughtException(Thread thread, @NonNull Throwable ex) {
    //AppRatingDialog.setInstalltionTime(0);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && ex.getClass().getName().contains("RemoteServiceException")) {
        if (ex.getMessage().contains("Couldn't update icon")) {
            Preferences.SHOW_ONGOING_NUMBER.set(false);
            //Toast.makeText(App.get(), "Crash detected. Show ongoing number disabled...", Toast.LENGTH_LONG).show();
            Crashlytics.setBool("WORKAROUND#1", true);
            Crashlytics.logException(ex);
            return;
        }
    }
    // This will make Crashlytics do its job
    mDefaultUEH.uncaughtException(thread, ex);
}
 
Example 6
Source File: App.java    From prayer-times-android with Apache License 2.0 5 votes vote down vote up
@Override
public void uncaughtException(Thread thread, @NonNull Throwable ex) {
    //AppRatingDialog.setInstalltionTime(0);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && ex.getClass().getName().contains("RemoteServiceException")) {
        if (ex.getMessage().contains("Couldn't update icon")) {
            Preferences.SHOW_ONGOING_NUMBER.set(false);
            //Toast.makeText(App.get(), "Crash detected. Show ongoing number disabled...", Toast.LENGTH_LONG).show();
            Crashlytics.setBool("WORKAROUND#1", true);
            Crashlytics.logException(ex);
            return;
        }
    }
    // This will make Crashlytics do its job
    mDefaultUEH.uncaughtException(thread, ex);
}
 
Example 7
Source File: SessionRecorder.java    From cannonball-android with Apache License 2.0 5 votes vote down vote up
private static void recordSessionState(String message,
                                       String userIdentifier,
                                       boolean active) {
    Crashlytics.log(message);
    Crashlytics.setUserIdentifier(userIdentifier);
    Crashlytics.setBool(App.CRASHLYTICS_KEY_SESSION_ACTIVATED, active);
}
 
Example 8
Source File: App.java    From cannonball-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    singleton = this;
    extractAvenir();
    authConfig
            = new TwitterAuthConfig(BuildConfig.CONSUMER_KEY, BuildConfig.CONSUMER_SECRET);
    Fabric.with(this, new Crashlytics(), new Digits(), new Twitter(authConfig), new MoPub());

    Crashlytics.setBool(CRASHLYTICS_KEY_CRASHES, areCrashesEnabled());
}
 
Example 9
Source File: SetBoolFunction.java    From ANE-Crashlytics with Apache License 2.0 5 votes vote down vote up
public FREObject call(FREContext context, FREObject[] args) {
	super.call(context, args);
	
	String key = getStringFromFREObject(args[0]);
	Boolean value = getBooleanFromFREObject(args[1]);
	Crashlytics.setBool(key, value);
	
	return null;
}
 
Example 10
Source File: App.java    From prayer-times-android with Apache License 2.0 3 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    Fabric.with(this, new Crashlytics());
    Crashlytics.setUserIdentifier(Preferences.UUID.get());
    if (BuildConfig.DEBUG)
        Crashlytics.setBool("isDebug", true);


    mDefaultUEH = Thread.getDefaultUncaughtExceptionHandler();
    Thread.setDefaultUncaughtExceptionHandler(mCaughtExceptionHandler);


    DateTimeZone.setProvider(new AndroidTimeZoneProvider());
    LocaleUtils.init(getBaseContext());


    registerReceiver(new TimeZoneChangedReceiver(), new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED));


    PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this);


    /*if (AppRatingDialog.getInstallationTime() == 0) {
        AppRatingDialog.setInstalltionTime(System.currentTimeMillis());
    }*/

    InternalBroadcastReceiver.loadAll();
    InternalBroadcastReceiver.sender(this).sendOnStart();
    TimeTickReceiver.start(this);

}
 
Example 11
Source File: App.java    From prayer-times-android with Apache License 2.0 3 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    Fabric.with(this, new Crashlytics());
    Crashlytics.setUserIdentifier(Preferences.UUID.get());
    if (BuildConfig.DEBUG)
        Crashlytics.setBool("isDebug", true);


    mDefaultUEH = Thread.getDefaultUncaughtExceptionHandler();
    Thread.setDefaultUncaughtExceptionHandler(mCaughtExceptionHandler);


    DateTimeZone.setProvider(new AndroidTimeZoneProvider());
    LocaleUtils.init(getBaseContext());


    registerReceiver(new TimeZoneChangedReceiver(), new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED));


    PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this);


    /*if (AppRatingDialog.getInstallationTime() == 0) {
        AppRatingDialog.setInstalltionTime(System.currentTimeMillis());
    }*/

    InternalBroadcastReceiver.loadAll();
    InternalBroadcastReceiver.sender(this).sendOnStart();
    TimeTickReceiver.start(this);

}