[英]NotificationListenerService called before Application.onCreate code
I have a NotificationListenerService
implementation in my app. 我的应用程序中有一个
NotificationListenerService
实现。
It seems that certain things that I initialize in my Application
class are not initialized when my NotificationListenerService
runs. 似乎在我的
NotificationListenerService
运行时,我在Application
类中初始化的某些事情没有初始化。 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. 另外,崩溃不是进入
Crashlytics
而是进入Google Play
,因此我假设也不发生crashlytics
的初始化。
NotificationListenerService
not being called in an app's process? NotificationListenerService
的服务类? Application
context? Application
上下文之外调用的吗? 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();
}
}
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. 似乎Google Play中约有95%的崩溃报告来自名为Vivo 1601的设备,因此这很可能是该设备上Android的错误实现,或者是根源设备反复崩溃。
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. 由于这不是Crashlytics,因此我无法确定有多少唯一用户报告了此崩溃,但是可以肯定地说这不是Android或我的应用程序中的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.