android notification only sound plays notification is not shown in notification drawer -
i trying fire notification in @ particular time using alarmmanager , notification manager. facing strange problem. when notification fired sound plays notification not shown in notification drawer. got error in log
04-26 11:32:09.217 1222-1222/? e/notificationservice﹕ warning: in future release crash app: com.example.shiv.selftweak
my code .
the class calls alarmmanager
intent intent1 = new intent(this, firenotification.class); pendingintent pendingintent = pendingintent.getservice(this, 1000, intent1, 0); alarmmanager = (alarmmanager)this.getsystemservice(alarm_service); am.set(alarmmanager.rtc_wakeup,system.currenttimemillis(), pendingintent);
firenotification class
public class firenotification extends service { @override public void oncreate() { intent intent = new intent(this, mainactivity.class); long[] pattern = {0, 300, 0}; pendingintent pi = pendingintent.getactivity(this, 1234, intent, 0); notificationcompat.builder mbuilder = new notificationcompat.builder(this) .setcontenttitle("self tweak") .setcontenttext("habbits waiting last dones") .setvibrate(pattern) .setautocancel(false); mbuilder.setcontentintent(pi); mbuilder.setdefaults(notification.default_sound); mbuilder.setautocancel(false); notificationmanager mnotificationmanager = (notificationmanager) this.getsystemservice(notification_service); mnotificationmanager.notify(1234, mbuilder.build()); } @override public ibinder onbind(intent intent) { return null; }
}
android menifest
<service android:name=".firenotification"></service> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher"/> </intent-filter>
when notification fires sound plays. not getting shown in notification drawer shows no notification.
the problem haven't specified mbuilder.setsmallicon(r.drawable.ic_launcher)
.
basically have set smallicon
, contenttitle
, contenttext
. if miss of notification not displayed @ all! that's specified here (also can read more notifications there well).
Comments
Post a Comment