3 Types of Customization That You Can Do To Android Alarm Clock Intent

Опубликовано: 05 Октябрь 2024
на канале: Coding Demos
2,631
32

Hi and welcome to another tutorial from CodingDemos :)

In this tutorial, you will learn about the 3 types of customization that you can do to the Android Alarm Clock Intent.

Here are the steps:
1- Open up Android Studio.

Customization #1:
2- You can set the alarm to be triggered repeatedly on certain days by using AlarmClock.EXTRA_DAYS. First, you need to create an ArrayList of a type Integer. This ArrayList will hold the days of which you want the alarm to be triggered.

ArrayList(Integer) daysOfWeek = new ArrayList();
daysOfWeek.add(Calendar.MONDAY);
daysOfWeek.add(Calendar.WEDNESDAY);
daysOfWeek.add(Calendar.FRIDAY);

3- Now you can include daysOfWeek as part of the Intent.

intent.putExtra(AlarmClock.EXTRA_DAYS, daysOfWeek);

Customization #2:

4- You can turn OFF the vibration when the alarm is triggered on your device.

intent.putExtra(AlarmClock.EXTRA_VIBRATE, false);

Customization #3:

Previously, when the user set the time and taps on the Set Alarm button, the user will be directed to the Clock app. You change the flow of how the user sets the alarm without letting the user leaves the app.

intent.putExtra(AlarmClock.EXTRA_SKIP_UI, true);

5- Build and run the app to see the result.

#androiddevelopment #androidprogramming #androidtutorial #androidstudio #androidstudiotutorial #java #codingdemos

Links:
How to Launch Alarm Clock Screen Using Intent in Android Programmatically:    • How to Launch Alarm Clock Screen Usin...  
Android Constraintlayout tutorial:    • Android Constraintlayout - Align Butt...  
Android TimePicker dialog tutorial:    • Android Timepicker – Use EditText to ...  
Website: https://www.codingdemos.com
FaceBook:   / codingdemos  

Introduction 00:00
Trigger the alarm on specific days 01:00
Turn OFF vibration when an alarm is triggered 06:15
Set alarm without leaving the app 07:25
Conclusion 10:10