Reputation: 1
I have an application with VebView and now I try to make a widget with message conversations. All is ok on my phone (Samsung), but on Xiaomi, every time when app is opening/closing/going to backgroud, system reset widget and load again. It doesn't look good. I found the problem is that every time system calls broadcast intent "android.intent.action.PACKAGE_CHANGED". I also found the problem arises when app is initializing OneSignal "OneSignal.initWithContext(this);". I was looking for the answer all internet but I cann't find anything about this problem. I would be very grateful for any opinion and help.
In my receiver
public class WidgetUpdateReceiver extends BroadcastReceiver {
public WidgetUpdateReceiver() {
super();
}
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction() != null && Intent.ACTION_PACKAGE_CHANGED.equals(intent.getAction())) {
String packageName = Objects.requireNonNull(intent.getData()).getSchemeSpecificPart();
if ("com.myapp.name".equals(packageName)) {
Log.d("WidgetUpdateReceiver", "Broadcast received");
}
}
}
}
I tried to receive that broadcast, but it is protected by system... Only when I removed line "OneSignal.initWithContext(this);", widget were allright and didn't blink.
Upvotes: 0
Views: 12