Skip to content

Commit 8759648

Browse files
committed
Make sure the notification alert only once
Test by enabling system apps, verify that it does not ring in the second time. Bug: 64611817 Change-Id: Ie2ea8ab95cdde74c289bcf79b78bdaba262a2826
1 parent 0f2fa0a commit 8759648

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/src/main/java/com/afwsamples/testdpc/PackageMonitorReceiver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import android.support.v7.app.NotificationCompat;
99
import android.support.v7.app.NotificationCompat.Builder;
1010
import android.text.TextUtils;
11-
1211
import com.afwsamples.testdpc.common.NotificationUtil;
1312

1413
public class PackageMonitorReceiver extends BroadcastReceiver {
@@ -37,6 +36,7 @@ public void onReceive(Context context, Intent intent) {
3736
.setContentText(notificationBody)
3837
.setStyle(new NotificationCompat.BigTextStyle().bigText(notificationBody))
3938
.setDefaults(Notification.DEFAULT_LIGHTS)
39+
.setOnlyAlertOnce(true)
4040
.build();
4141
NotificationManager notificationManager =
4242
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

0 commit comments

Comments
 (0)