Skip to content

armgit / haven

Public Imported from GitHub
0

Haven is for people who need a way to protect their personal spaces and possessions without compromising their own privacy, through an Android app and on-device sensors

remove notifications, and hide them from lockscreen

n8fr8fe0d3639273f
diff --git a/src/main/java/info/guardianproject/phoneypot/service/MonitorService.java b/src/main/java/info/guardianproject/phoneypot/service/MonitorService.java
index a9d2f2a..04471de 100644
--- a/src/main/java/info/guardianproject/phoneypot/service/MonitorService.java
+++ b/src/main/java/info/guardianproject/phoneypot/service/MonitorService.java
@@ -140,14 +140,14 @@ public class MonitorService extends Service {
*/
@SuppressWarnings("deprecation")
private void showNotification() {
-
Intent toLaunch = new Intent(getApplicationContext(),
MonitorActivity.class);
- toLaunch.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT
- |Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
- |Intent.FLAG_ACTIVITY_NEW_TASK);
+ toLaunch.setAction(Intent.ACTION_MAIN);
+ toLaunch.addCategory(Intent.CATEGORY_LAUNCHER);
+ toLaunch.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+
PendingIntent resultPendingIntent =
PendingIntent.getActivity(
this,
@@ -155,6 +155,7 @@ public class MonitorService extends Service {
toLaunch,
PendingIntent.FLAG_UPDATE_CURRENT
);
+
// In this sample, we'll use the same text for the ticker and the expanded notification
CharSequence text = getText(R.string.secure_service_started);
@@ -164,11 +165,11 @@ public class MonitorService extends Service {
.setContentTitle(getString(R.string.app_name))
.setContentText(text);
-
+ mBuilder.setPriority(NotificationCompat.PRIORITY_MIN);
mBuilder.setContentIntent(resultPendingIntent);
+ mBuilder.setWhen(System.currentTimeMillis());
- startForeground(0, mBuilder.build());
-
+ startForeground(1, mBuilder.build());
}
@@ -225,7 +226,7 @@ public class MonitorService extends Service {
}
- showNotificationAlert(alertMessage.toString());
+
mLastAlert = alertType;
}