Skip to content

Commit

Permalink
#155 - set constant for notification id to avoid multiple notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
thuryn committed Nov 21, 2020
1 parent 74b1eb0 commit a2bd7b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private void registerSensorListener() {
return;
}

startForeground(android.os.Process.myPid(), notification);
startForeground(NotificationUtils.NOTIFICATION_ID, notification);

sensorResolutionMultiplayer = 1 / senAccelerometer.getResolution();
int maxDelay = 10000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public class NotificationUtils {

private static final String TAG = "NotificationUtils";

public static final int NOTIFICATION_ID = 2109876543;

public static void weatherNotification(Context context, Long locationId) {
/*String updateAutoPeriodStr = AppPreference.getLocationAutoUpdatePeriod(context);
boolean updateBySensor = "0".equals(updateAutoPeriodStr);
Expand Down Expand Up @@ -136,7 +138,7 @@ public static Notification getNotification(Context context, Location location, C
public static void showNotification(Context context, Notification notification) {
NotificationManager notificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(android.os.Process.myPid(), notification);
notificationManager.notify(NOTIFICATION_ID, notification);
}

private static Notification regularNotification(Context context,
Expand Down

0 comments on commit a2bd7b5

Please sign in to comment.