我希望创建一个通知(来自BroadcastReceiver - 如果有区别的话)
我不知道为什么,但它就是没有显示出来!
private void showNotification(Context context, String text) {
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.notification_icon)
.setContentTitle(getString(R.string.app_name))
.setContentText(text)
.setAutoCancel(true);
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(0, mBuilder.build());
}
我尝试过这个(以及这个),这些都与IT技术有关。