66import android .content .Context ;
77import android .content .Intent ;
88import android .net .Uri ;
9- 109import androidx .core .app .NotificationCompat ;
11- 1210import it .ezzie .smartalarm .R ;
1311
1412public class AlarmReceiver extends BroadcastReceiver {
@@ -28,14 +26,19 @@ private void createChannel(Context context , String alarmLabel){
2826 //Create Ringtone
2927 Uri ringtoneUri = Uri .parse ("android.resource://" + context .getPackageName () + "/" + R .raw .playing_god );
3028 //Creating Notification Channel
31- NotificationChannel notificationChannel = new NotificationChannel (channelId ,"Alarm Notification" , NotificationManager .IMPORTANCE_HIGH );
32- notificationChannel .setSound (ringtoneUri ,null );
29+ NotificationChannel notificationChannel = new NotificationChannel (channelId ,"Alarm Notification" , NotificationManager .IMPORTANCE_HIGH );
30+ notificationChannel .setSound (ringtoneUri ,null );
3331 //Creating Notification Manager
3432 NotificationManager notificationManager = context .getSystemService (NotificationManager .class );
3533 notificationManager .createNotificationChannel (notificationChannel );
3634 //Creating Notification Builder
37- NotificationCompat .Builder builder = new NotificationCompat .Builder (context ,channelId )
38- .
35+ NotificationCompat .Builder builder = new NotificationCompat .Builder (context , channelId )
36+ .setContentTitle ("Alarm" )
37+ .setContentText (alarmLabel )
38+ .setSmallIcon (R .drawable .alarm_Icon )
39+ .setPriority (NotificationCompat .PRIORITY_HIGH );
40+ 41+ notificationManager .notify (1 , builder .build ());
3942 }
4043 }
4144}
0 commit comments