Advanced Setup

Use the Privacy Dialog

By default, this feature is disabled. When a crash occurs in any version of your app, this will ask your users if that crash should be reported. If you’d like to enable it, you can do it in your app settings page. Finally, select the app and click on “Enable Privacy Prompt”.

Note

If you want to use the Privacy Dialog, an Activity context is needed in order to display the UI prompt to allow or deny sending of the crash report. As a result, you need to move the initialization of Fabric to your application’s MainActivity’s onCreate.

Localizing the Dialog

To localize the dialog, create localized string resources with some specific names. Here’s a strings.xml file with all the string resource names we’ll look for and some example values:

<?xml version="1.0" encoding="utf-8"?>
    <resources>
    <string name="com.crashlytics.CrashSubmissionPromptTitle">
          Send Crash Report?</string>
    <string name="com.crashlytics.CrashSubmissionPromptMessage">
          Looks like we crashed! Please help us fix the problem
          by sending a crash report.</string>
    <string name="com.crashlytics.CrashSubmissionSendTitle">
          Send</string>
    <string name="com.crashlytics.CrashSubmissionAlwaysSendTitle">
          Always Send</string>
    <string name="com.crashlytics.CrashSubmissionCancelTitle">
          Don't Send</string>
</resources>

Proxy setup

On Windows, in Program Files/Android/Android-Studio/bin/ open these two files: studio.exe.vmoptions and studio64.exe.vmoptions

On Mac, open up the Android Studio package contents in the bin/ folder called idea.vmoptions.

Add these settings to your respective file or files:

-Dhttps.proxyPort=your-value-here
-Dhttps.proxyHost=your-value-here
-Dhttps.proxyUser=your-value-here
-Dhttps.proxyPassword=your-value-here

Enable opt-in reporting

For various reasons, you may need to ensure that you’re users have given consent that information such as crash reports or analytics can be collected. There are many ways to do this and you should use the method that is most applicable to your app. Please note, you should talk with your own legal counsel in order to confirm your app’s specific needs. An example would be to have a setting that is configurable by your app’s end user and then check that setting before initializing Fabric.

public class MainActivity extends AppCompatActivity {
  @Override
  protected void onCreate*Bundle savedInstanceState{
    super.onCreate(savedInstanceState);

    boolean userOptInFlag = CheckOptInValue();

    if (userOptInFlag == true){
      //Only initialize Fabtric is user opt-in is true
      Fabric.with(this, new Crashlytics());
    }

    setContentView(R.layout_activity_main);
  }

  boolean CheckOptInValue(){
    //check opt-in value
    //return true; //if user opted-in
    return false;
  }
}

Opt-out after opt-in

If a user changes their data collection preference within your app, in the above example, userOptInFlag, you should advise users to completely quit the app in order for the change to take effect. Backgrounding the app will not pull in the updated setting, a new launch of the app is required.