Java Code Examples for org.acra.data.StringFormat

The following examples show how to use org.acra.data.StringFormat. These examples are extracted from open source projects. 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 Project: BaldPhone   Source File: BaldPhone.java    License: 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 Project: TowerCollector   Source File: MyApplication.java    License: 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
@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
public CustomHttpSender(CoreConfiguration config, Method method, StringFormat type, String formUri) {
    super(config, method, type, formUri);
}
 
Example 5
public CustomHttpSender(CoreConfiguration config, Method method, StringFormat type) {
    super(config, method, type);
}