From 1cea7e728414b93dac4dd2ada4e3844d9d234adf Mon Sep 17 00:00:00 2001 From: Electric Date: Tue, 12 May 2020 23:31:10 +0300 Subject: [PATCH] Bump version to 1.4 --- .../java/com/dosse/airpods/PodsService.java | 48 ++++++++----------- 1 file changed, 19 insertions(+), 29 deletions(-) diff --git a/OpenPods/app/src/main/java/com/dosse/airpods/PodsService.java b/OpenPods/app/src/main/java/com/dosse/airpods/PodsService.java index 14ebdb1..b914ffd 100644 --- a/OpenPods/app/src/main/java/com/dosse/airpods/PodsService.java +++ b/OpenPods/app/src/main/java/com/dosse/airpods/PodsService.java @@ -280,6 +280,10 @@ public class PodsService extends Service { private class NotificationThread extends Thread { + private boolean getRunningLoop (int test) { + return getApplicationContext().getApplicationInfo().targetSdkVersion == test; + } + private boolean isLocationEnabled () { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { getApplicationContext(); @@ -313,6 +317,7 @@ public class PodsService extends Service { public void run () { boolean notificationShowing = false; + boolean loopRunning = getRunningLoop(29); RemoteViews notificationBig = new RemoteViews(getPackageName(), R.layout.status_big); RemoteViews notificationSmall = new RemoteViews(getPackageName(), R.layout.status_small); @@ -324,14 +329,7 @@ public class PodsService extends Service { mBuilder.setOngoing(true); mBuilder.setSmallIcon(R.mipmap.notification_icon); - /* - // Adding a pending intent that would open the app if the user clicks on the notification. - PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, new Intent(getApplicationContext(), MainActivity.class), PendingIntent.FLAG_UPDATE_CURRENT); - mBuilder.setContentIntent(pendingIntent); - */ - - //noinspection InfiniteLoopStatement - for (; ; ) { + while (loopRunning) { /*&&System.currentTimeMillis()-lastSeenConnected