marmor
marmor

Reputation: 28189

NotificationListenerService called before Application.onCreate code

I have a NotificationListenerService implementation in my app.

It seems that certain things that I initialize in my Application class are not initialized when my NotificationListenerService runs. Also, crashes are not coming into Crashlytics, but into Google Play instead, so I'm assuming the initialization of crashlytics isn't happening as well.

Simplified implementation of my code:

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        Settings.init(this);
    }
}

public class MyNotificationService extends NotificationListenerService {
    @Override
    public void onCreate() {
        super.onCreate();
        new AsyncTask<Void, Void, Void>() {
            @Override
            protected Void doInBackground(Void... params) {
                if (Settings.getSomething()) { // Crash! settings not initialized
                    ...
                }
            }
        }.execute();
    }
}

Upvotes: 2

Views: 176

Answers (1)

marmor
marmor

Reputation: 28189

It seems ~95% of reported crashes in Google Play come from a device called Vivo 1601, so this is most likely a bad implementation of Android on the device, or a rooted device repeatedly crashing.

Since this is not Crashlytics, I can't tell how many unique users have reported this crash, but it is safe to say It's not an issue in Android or my app.

Upvotes: 1

Related Questions