2

タイトルの通り、android localnotification phonegap プラグインを使用しています。これで、そのバーに通知を強制することができます。そのバーに触れると、アプリが再び開きますが、その通知はまだ通知バーにあります。

ここでの質問は、アプリが再度開かれたときに通知バーでその通知をクリアする方法ですか?

ありがとう。

4

1 に答える 1

0

AlarmReceiver.javaを見てAlarmReceiver::onReceive(Context context, Intent intent)ください。に設定する必要がAutoCancelありNotificationます。

使用している API のバージョンによって、これは異なる場合があります。バージョン 17 の場合、次のようになります。

final Notification notification = new NotificationCompat.Builder(context)
    .setTicker(tickerText)
    .setSmallIcon( context.getResources().getIdentifier("myicon" , 
                                "drawable", context.getPackageName()) )
    .setWhen(System.currentTimeMillis())
    .setContentTitle(notificationTitle)
    .setContentText(notificationSubText)
    .setContentIntent(contentIntent)
//    .setVibrate(new long[] { 0, 100, 200, 300 })
    .setAutoCancel(true) // <------- here you remove the message 
    .build();

notificationMgr.notify(notificationId, notification);
于 2013-02-19T14:37:22.127 に答える