NotificationManager MyNotiManager=(NotificationManager)getSystemService(NOTIFICATION_SERVICE); Intent notifyIntenet=new Intent("PublicServerFilter"); notifyIntenet.putExtras(bundle); notifyIntenet.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent appIn=PendingIntent.getBroadcast(getBaseContext(), 0, notifyIntenet, PendingIntent.FLAG_CANCEL_CURRENT); Notification myNoti=new Notification(); if(IconId>0) myNoti.icon=IconId; myNoti.tickerText=msg; myNoti.defaults=Notification.DEFAULT_SOUND; myNoti.when= System.currentTimeMillis(); myNoti.setLatestEventInfo(getBaseContext(), title, msg, appIn); MyNotiManager.notify(PublicNotificationId,myNoti);
在写这样一个函数的时候,错误,是不是在初始化
Intent notifyIntenet=new Intent("PublicServerFilter");
不能使用这个呢。因为我不想毁掉到class上,直接回调到系统的函数上。
所以就这样初始化了。就这样报错。
ERROR/AndroidRuntime(255): java.lang.IllegalArgumentException: Can't use FLAG_RECEIVER_BOOT_UPGRADE here
到2.2上的机器跑就行了