java警报,通知无错误,但不显示
我试图在Android Studio中使用通知发出警报,我尝试了this link,但出现了错误“强制关闭”。日志Cat中没有错误消息。请帮我找出这个问题。我的完整代码My Complete Code is here
public class MyAlarm extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.d("Mine", "Set Daily");
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.ic_notifications_white)
.setContentTitle("My notification")
.setContentText("Hello World!");
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(001, mBuilder.build());
}
}
# 1 楼答案
我猜你没有把广播接收器包括在AndroidManifest中。xml