org.acra.sender.HttpSender Java Examples
The following examples show how to use
org.acra.sender.HttpSender.
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 |
@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 |
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); }