From cab886d87233b29d66590363048e14eea2161d6a Mon Sep 17 00:00:00 2001 From: Parvesh Monu Date: Mon, 4 Jan 2021 22:56:40 +0530 Subject: [PATCH] fixed service --- app/build.gradle | 4 ++-- app/release/output-metadata.json | 4 ++-- .../jiofibatterynotifier/Services/JioFiService.java | 11 +++++++---- app/src/main/res/layout/custom_message_contact.xml | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a6c5625..ebf494d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "espero.jiofibatterynotifier" minSdkVersion 17 targetSdkVersion 29 - versionCode 5 - versionName "1.5" + versionCode 6 + versionName "1.6" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json index 6ad935f..a88909d 100644 --- a/app/release/output-metadata.json +++ b/app/release/output-metadata.json @@ -11,8 +11,8 @@ "type": "SINGLE", "filters": [], "properties": [], - "versionCode": 5, - "versionName": "1.5", + "versionCode": 6, + "versionName": "1.6", "enabled": true, "outputFile": "app-release.apk" } diff --git a/app/src/main/java/espero/jiofibatterynotifier/Services/JioFiService.java b/app/src/main/java/espero/jiofibatterynotifier/Services/JioFiService.java index b8406a9..7a3916e 100644 --- a/app/src/main/java/espero/jiofibatterynotifier/Services/JioFiService.java +++ b/app/src/main/java/espero/jiofibatterynotifier/Services/JioFiService.java @@ -196,11 +196,14 @@ private void sendRequest(){ boolean charging = true; if (m.find( )) { percentage = m.group(2); + if(response.toLowerCase().contains("discharging")){ + charging = false; + } + updateBatteryData(percentage, charging); + }else{ + updateNotification("JioFi Not Connected", R.drawable.icon, false); } - if(response.toLowerCase().contains("discharging")){ - charging = false; - } - updateBatteryData(percentage, charging); + }, error -> { updateNotification("JioFi Not Connected", R.drawable.icon, false); // Log.d(TAG_FOREGROUND_SERVICE, "URL" + url); diff --git a/app/src/main/res/layout/custom_message_contact.xml b/app/src/main/res/layout/custom_message_contact.xml index 18979a9..6944763 100755 --- a/app/src/main/res/layout/custom_message_contact.xml +++ b/app/src/main/res/layout/custom_message_contact.xml @@ -14,7 +14,7 @@ android:layout_gravity="center" android:layout_marginTop="10dp" android:fontFamily="sans-serif" - android:text="Android JioFi Battery Notifier 1.5" + android:text="Android JioFi Battery Notifier 1.6" android:textAlignment="center" android:textColor="#000" android:textSize="18sp" />