Skip to content

Commit

Permalink
Fixed Issue #1
Browse files Browse the repository at this point in the history
  • Loading branch information
Parveshdhull committed Aug 27, 2021
1 parent 7409d2e commit c0099ed
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "espero.jiofibatterynotifier"
minSdkVersion 17
targetSdkVersion 29
versionCode 7
versionName "1.7"
versionCode 8
versionName "1.8"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"properties": [],
"versionCode": 7,
"versionName": "1.7",
"versionCode": 8,
"versionName": "1.8",
"enabled": true,
"outputFile": "app-release.apk"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.MediaPlayer;
import android.media.RingtoneManager;
import android.net.Uri;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.IBinder;
import android.os.Vibrator;
import android.util.Log;
import android.widget.Toast;

Expand Down Expand Up @@ -55,6 +57,10 @@ public JioFiService() {
@Override
public void onDestroy() {
try {
if (mp != null) {
mp.stop();
mp = null;
}
if(thread != null && thread.isAlive()){
thread.interrupt();
thread = null;
Expand All @@ -79,6 +85,9 @@ public IBinder onBind(Intent intent) {
@Override
public void onCreate() {
super.onCreate();
mp = MediaPlayer.create(this, R.raw.low);
mp.setLooping(false);
mp.setVolume(0.5f, 0.5f);
sharedPrefMain = new SharedPrefMain(this);
Log.d(TAG_FOREGROUND_SERVICE, "My foreground service onCreate().");
IntentFilter intentFilter = new IntentFilter();
Expand Down Expand Up @@ -335,12 +344,31 @@ private Notification getNotification(String msg, int small_icon, boolean playSou
.setContentIntent(pendingIntent).setOnlyAlertOnce(true);
if(sharedPrefMain.getBoolean("alerts") && playSound && ((System.currentTimeMillis() - sharedPrefMain.getLong("notif")) > (1000 * 60 * 5))){
sharedPrefMain.setLong("notif", System.currentTimeMillis());
showAlert(msg);
alert();
// showAlert(msg);
}


return notificationBuilder.build();
}
private MediaPlayer mp;

private void alert() {
if (sharedPrefMain.getBoolean("vibrate")) {
Vibrator vibrator;
vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vibrator.vibrate(500);
}
if (sharedPrefMain.getBoolean("sound")) {
try {
if (mp != null) {
mp.start();
}
} catch (Exception e) {
}
}
}

private void updateNotification(String msg, int icon, boolean playSOund){
if(!checkWifiOnAndConnected()){
msg = "JioFi Not Connected";
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/custom_message_contact.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:fontFamily="sans-serif"
android:text="Android JioFi Battery Notifier 1.7"
android:text="Android JioFi Battery Notifier 1.8"
android:textAlignment="center"
android:textColor="#000"
android:textSize="18sp" />
Expand Down

0 comments on commit c0099ed

Please sign in to comment.