android - Getting a error with Firebase Cloud Messaging -
i'm starting firebase
, trying kind of complex code saw on tutorial, , error, copied simple code, basic, i'm still getting same error, please me, i'm gonna put firebaseinstanceidservice
, firebasemessagingservice
, if need further information please let me know.
the error i'm getting
fatal exception: main process: com.bim.tech.construbimapp, pid: 30988 android.app.remoteserviceexception: bad notification posted package com.bim.tech.construbimapp: couldn't expand remoteviews for: statusbarnotification(pkg=com.bim.tech.construbimapp user=userhandle{0} id=0 tag=fcm-notification:250274573 score=0 key=0|com.bim.tech.construbimapp|0|fcm-notification:250274573|10184: notification(pri=0 contentview=com.bim.tech.construbimapp/0x1090077 vibrate=null sound=null defaults=0x0 flags=0x10 color=0x00000000 vis=private)) @ android.app.activitythread$h.handlemessage(activitythread.java:1638) @ android.os.handler.dispatchmessage(handler.java:111) @ android.os.looper.loop(looper.java:194) @ android.app.activitythread.main(activitythread.java:5637) @ java.lang.reflect.method.invoke(native method) @ java.lang.reflect.method.invoke(method.java:372) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:959) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:754)
firebasemessagingservice
public class mifirebasemessagingservice extends firebasemessagingservice { public static final string tag = "servicios"; @override public void onmessagereceived(remotemessage remotemessage) { super.onmessagereceived(remotemessage); string = remotemessage.getfrom(); log.d(tag, "mensaje recibido de " + from); if(remotemessage.getnotification() != null){ log.d(tag, "notificacion" + remotemessage.getnotification().getbody()); mostrarnotificacion(remotemessage.getnotification().gettitle(), remotemessage.getnotification().getbody()); } if(remotemessage.getdata().size() > 0 ){ log.d(tag, "data: " + remotemessage.getdata()); } } private void mostrarnotificacion(string title, string body) { uri sounduri = ringtonemanager.getdefaulturi(ringtonemanager.type_notification); intent intent = new intent(this, activity_metodos_de_pago.class); pendingintent pendingintent = pendingintent.getactivity(this, 0, intent, pendingintent.flag_one_shot); notificationcompat.builder notificationbuilder = (notificationcompat.builder) new notificationcompat.builder(this) .setsmallicon(r.drawable.builder) .setcontenttitle(title) .setcontenttext(body) .setautocancel(true) .setsound(sounduri) .setcontentintent(pendingintent); notificationmanager notificationmanager = (notificationmanager) getsystemservice(context.notification_service); notificationmanager.notify(0, notificationbuilder.build()); } }
firebaseinstanceidservice
public class mifirebaseinstanceidservice extends firebaseinstanceidservice { @override public void ontokenrefresh() { super.ontokenrefresh(); string token = firebaseinstanceid.getinstance().gettoken(); log.d(tag, "token: " + token); enviartokenalservidor(token); } private void enviartokenalservidor(string token) { } }
thanks.
Comments
Post a Comment