私のアプリを強制終了しても通知が消えないすなわち、マルチタスクウィンドウを開いてそれをスワイプすると、私の永続的な通知は消えません。私のアプリを強制終了しても通知が消えない
これは私の通知populateメソッドです:
public void populateNotification(Boolean bool) {
int notifyID = 1;
notificationBuilder = new NotificationCompat.Builder(MainActivity.this);
notificationBuilder.setSmallIcon(R.mipmap.ic_launcher_round);
notificationBuilder.setContentText("Set Content Text");
notificationBuilder.setContentTitle("Set Content Title");
notificationManager = (NotificationManager) getBaseContext().getApplicationContext().getSystemService(NOTIFICATION_SERVICE);
if (bool) {
notificationManager.notify(notifyID, notificationBuilder.build());
} else {
notificationManager.cancel(notifyID);
}
これは私のonDestroy方法であって、基本的に
`
public void onDestroy() {
if (cameraAPIself != null) {
cameraAPIself.destroyCamera();
}
if (cameraAPI2self != null) {
cameraAPI2self.destroyCamera();
}
populateNotification(false);
super.onDestroy();
}`
何私のアプリが行うことはフラッシュがONのときには通知を示しています。しかし、私は強制的に私のアプリを閉じる。フラッシュがオンになっているとき(通知が入力されるとき)、アプリケーションはもはやアクティブではないので、通知の必要がないので、通知は消えない。誰も私をここで案内することはできますか?
ありがとうたくさんの男、魅力のように動作します:) –
あなたは大歓迎です:) –