org.acra.data.StringFormat Java Examples

The following examples show how to use org.acra.data.StringFormat. 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: BaldPhone.java    From BaldPhone with Apache License 2.0 6 votes vote down vote up
@Override
protected void attachBaseContext(final Context base) {
    super.attachBaseContext(base);
    final CoreConfigurationBuilder builder =
            new CoreConfigurationBuilder(this)
                    .setBuildConfigClass(BuildConfig.class)
                    .setReportFormat(StringFormat.JSON);
    builder.getPluginConfigurationBuilder(HttpSenderConfigurationBuilder.class)
            .setUri(getString(R.string.tt_url))
            .setHttpMethod(HttpSender.Method.POST)
            .setEnabled(true);
    ACRA.init(this, builder);

    Thread.setDefaultUncaughtExceptionHandler(
            new BaldUncaughtExceptionHandler(this, Thread.getDefaultUncaughtExceptionHandler())
    );
}
 
Example #2
Source File: MyApplication.java    From TowerCollector with Mozilla Public License 2.0 5 votes vote down vote up
private void initACRA() {
    Timber.d("initACRA(): Initializing ACRA");

    CoreConfigurationBuilder configBuilder = new CoreConfigurationBuilder(this);
    // Configure connection
    configBuilder.setBuildConfigClass(BuildConfig.class);
    configBuilder.setSendReportsInDevMode(BuildConfig.ACRA_SEND_REPORTS_IN_DEV_MODE);
    configBuilder.setReportFormat(StringFormat.valueOf(BuildConfig.ACRA_REPORT_TYPE));
    configBuilder.setExcludeMatchingSharedPreferencesKeys(getString(R.string.preferences_api_key_key));
    configBuilder.setReportContent(getCustomAcraReportFields());
    // Configure reported content
    HttpSenderConfigurationBuilder httpPluginConfigBuilder = configBuilder.getPluginConfigurationBuilder(HttpSenderConfigurationBuilder.class);
    httpPluginConfigBuilder.setUri(BuildConfig.ACRA_FORM_URI);
    httpPluginConfigBuilder.setBasicAuthLogin(BuildConfig.ACRA_FORM_URI_BASIC_AUTH_LOGIN);
    httpPluginConfigBuilder.setBasicAuthPassword(BuildConfig.ACRA_FORM_URI_BASIC_AUTH_PASSWORD);
    httpPluginConfigBuilder.setHttpMethod(HttpSender.Method.valueOf(BuildConfig.ACRA_HTTP_METHOD));
    httpPluginConfigBuilder.setEnabled(true);
    // Configure interaction method
    NotificationConfigurationBuilder notificationConfigBuilder = configBuilder.getPluginConfigurationBuilder(NotificationConfigurationBuilder.class);
    notificationConfigBuilder.setResChannelName(R.string.error_reporting_notification_channel_name);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        notificationConfigBuilder.setResChannelImportance(NotificationManager.IMPORTANCE_DEFAULT);
    }
    notificationConfigBuilder.setResIcon(R.drawable.ic_notification);
    notificationConfigBuilder.setResTitle(R.string.error_reporting_notification_title);
    notificationConfigBuilder.setResText(R.string.error_reporting_notification_text);
    notificationConfigBuilder.setResTickerText(R.string.error_reporting_notification_title);
    notificationConfigBuilder.setResSendButtonText(R.string.dialog_send);
    notificationConfigBuilder.setResDiscardButtonText(R.string.dialog_cancel);
    notificationConfigBuilder.setSendOnClick(true);
    notificationConfigBuilder.setResSendWithCommentButtonText(R.string.dialog_send_comment);
    notificationConfigBuilder.setResCommentPrompt(R.string.error_reporting_notification_comment_prompt);
    notificationConfigBuilder.setEnabled(!getPreferencesProvider().getReportErrorsSilently());

    ACRA.init(this, configBuilder);
    ACRA.getErrorReporter().putCustomData("APP_MARKET_NAME", BuildConfig.MARKET_NAME);
}
 
Example #3
Source File: CustomHttpSenderFactory.java    From mosmetro-android with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
@Override
public ReportSender create(@NonNull Context context, @NonNull CoreConfiguration config) {
    return new CustomHttpSender(
            config,
            Method.POST,
            StringFormat.JSON, 
            "https://collector.tracepot.com/" + BuildConfig.TRACEPOT_ID
    );
}
 
Example #4
Source File: CustomHttpSender.java    From mosmetro-android with GNU General Public License v3.0 4 votes vote down vote up
public CustomHttpSender(CoreConfiguration config, Method method, StringFormat type, String formUri) {
    super(config, method, type, formUri);
}
 
Example #5
Source File: CustomHttpSender.java    From mosmetro-android with GNU General Public License v3.0 4 votes vote down vote up
public CustomHttpSender(CoreConfiguration config, Method method, StringFormat type) {
    super(config, method, type);
}