Search code examples
androidreact-nativecrash-reportsacra

ACRA Mailer not giving me share file as window in Android 10


I am using ACRA 5.5.1 in React Native 0.61.2. I am using Dailog + Mailer feature to send the crash reports.

@AcraCore(buildConfigClass = BuildConfig.class,
    reportFormat = StringFormat.JSON)
@AcraMailSender(mailTo = "email",
   resSubject = R.string.acra_mail_subject,
   reportFileName = "ErrorReport",
   reportAsFile = true)
@AcraToast(resText = R.string.acra_toast_text)
public class MainApplication extends Application implements ReactApplication {

@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    CoreConfigurationBuilder builder = new CoreConfigurationBuilder(this)
            .setBuildConfigClass(BuildConfig.class)
            .setReportFormat(StringFormat.JSON);
    builder.getPluginConfigurationBuilder(ToastConfigurationBuilder.class)
            .setResText(R.string.acra_toast_text);
   builder.getPluginConfigurationBuilder(MailSenderConfigurationBuilder.class)
           .setMailTo("email")
           .setResSubject(R.string.acra_mail_subject)
           .setReportFileName("ErrorReport")
           .setReportAsFile(true);
    ACRA.init(this, builder);
}}

Now, when I am using the APK in android 5.0, everytime my app crashes it open up a small window at bottom to share the report via email. The image bellow shows the share option popping up in Android 5.0, Phone is Sony Xperia E2362.

enter image description here

But when I am using the APK in Android 10, phone xiaomi poco f1. It doesn't show me any window to share the file. But right after I install my app, xiaomi scans the app and gives one option to open it. And when I open the app from that window I get that share report via email popup, after the app crashes. But not when I normally open my app from app menu. Bellow image shows the app scanning window which shows an option to open app and the second image which shows the share report via email when I use scanning window to open app.

enter image description here enter image description here

I don't know what am I missing. Please help.


Solution

  • After talking with other people on github and going to the logcat logs, I found that Xiaomi phone was blocking the pop-up. So, app needs a permission to display pop-up windows while running in the background.

    So, the solution is, when the app starts inform user to give permissions for pop-up window while running in the background.