Notificación incorrecta: no se pudo expandir RemoteViews para: StatusBarNotification. en Android Nougat
yo sueloOneSignal SDK
para mostrar notificaciones. Lo hago enOneSignalPushService.java
.
OneSignalPushService.java:
public class OneSignalPushService extends NotificationExtenderService {
@Override
protected boolean onNotificationProcessing(OSNotificationReceivedResult notification) {
if (!TinyDbWrap.getInstance().isPushEnabled()) {
KLog.d(this.getClass().getSimpleName(), "Notification will not displayed");
return true;
}
OverrideSettings overrideSettings = new OverrideSettings();
overrideSettings.extender = new NotificationCompat.Extender() {
@Override
public NotificationCompat.Builder extend(NotificationCompat.Builder notificationBuilder) {
notificationBuilder.setDefaults(0);
notificationBuilder.setContentTitle(getApplicationContext().getResources().getString(R.string.app_name));
boolean is_in_silent_mode = false; /*or true by user's settings in app*/
/*TinyDbWrap.getInstance()... - it stores user's settings*/
KLog.d(OneSignalPushService.class.getSimpleName(), "Notification isSoundPushEnabled: " + TinyDbWrap.getInstance().isSoundPushEnabled());
if (!is_in_silent_mode && TinyDbWrap.getInstance().isSoundPushEnabled()) {
notificationBuilder.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION));
} else {
notificationBuilder.setSound(null);
}
KLog.d(OneSignalPushService.class.getSimpleName(), "Notification isVibrationPushEnabled: " + TinyDbWrap.getInstance().isVibrationPushEnabled());
if (!is_in_silent_mode && TinyDbWrap.getInstance().isVibrationPushEnabled()) {
notificationBuilder.setVibrate(new long[]{0, 100, 200, 300, 400});
} else {
notificationBuilder.setVibrate(new long[]{0});
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
notificationBuilder.setColor(ContextCompat.getColor(getApplicationContext(), R.color.bg_first_item_white_scheme));
}
notificationBuilder.setLights(ContextCompat.getColor(getApplicationContext(), R.color.time_white_sheme), 500, 500);
return notificationBuilder;
}
};
OSNotificationDisplayedResult result = displayNotification(overrideSettings);
if (result != null) {
KLog.d(OneSignalPushService.class.getSimpleName(), "Notification displayed with id: " + result.androidNotificationId);
}
return true;
}
}
Esto funciona bien en todos mis dispositivos pero:
Recibo una gran cantidad de este problema en Crashlytics solo en dispositivos con Android Nougat:
Excepción fatal: android.app.RemoteServiceException: notificación incorrecta publicada desde el paquete my.package: No se pudo expandir RemoteViews para: StatusBarNotification (pkg = my.package user = UserHandle {0} id = -1542711428 tag = null key = 0 | my .package | -1542711428 | null | 10184: Notificación (pri = 0 contentView = null vibrate = null sound = null defaults = 0x0 flags = 0x19 color = 0xff56a0d3 vis = PUBLIC semFlags = 0x0 semPriority = 0)) en android.app.ActivityThread $ H.handleMessage (ActivityThread.java:1813) en android.os.Handler.dispatchMessage (Handler.java:102) en android.os.Looper.loop (Looper.java:154) en android.app.ActivityThread.main ( ActivityThread.java:6776) en java.lang.reflect.Method.invoke (Method.java) en com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:1496) en com.android.internal.os .ZygoteInit.main (ZygoteInit.java:1386)
Lamentablemente, no puedo reproducir este problema en mis dispositivos conAndroid Nougat
para entender cómo puedo eliminarlo.
Traté de cambiar los recursos gráficos, como los iconos de notificación, para limpiar el proyecto a fin de seguireste consejo.
Noté que el número de dispositivos con este problema aumenta durante una semana cuando lanzo una nueva versión de la aplicación, luego estos números disminuyen a cero.
Este problema tambiéninformado a Google ydesarrolladores deOneSignal
SDK.
Estoy buscando soluciones, ideas o sugerencias que puedan ayudar a eliminar este problema.