Skip to content

Commit

Permalink
add notification sound
Browse files Browse the repository at this point in the history
  • Loading branch information
tanjim17 committed Jan 28, 2021
1 parent 9c444ae commit 322f1e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "tj.beataddiction"
minSdkVersion 24
targetSdkVersion 29
versionCode 4
versionName "1.3"
versionCode 5
versionName "1.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/tj/beataddiction/BackgroundService.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.content.Intent;
import android.content.pm.PackageManager;
import android.icu.util.Calendar;
import android.media.RingtoneManager;
import android.util.Log;

import androidx.annotation.NonNull;
Expand Down Expand Up @@ -78,7 +79,8 @@ private void showNotification(String appName, int id) {
.setContentTitle(appName + " usage exceeded!")
.setContentText("Close your app now!")
.setSmallIcon(R.drawable.warning)
.setPriority(Notification.PRIORITY_MAX);
.setPriority(Notification.PRIORITY_MAX)
.setSound(RingtoneManager. getDefaultUri (RingtoneManager. TYPE_NOTIFICATION));
NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(id, builder.build());
}
Expand Down

0 comments on commit 322f1e7

Please sign in to comment.