Android Alarm Clock UI
The stock alarm clock app is open source, so check it out by yourself.
Preference Layout see here:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/set_alarm">
<CheckBoxPreference android:key="on"
android:title="@string/enable"/>
<Preference android:key="time"
android:title="@string/time"/>
<com.android.alarmclock.AlarmPreference
android:key="alarm"
android:title="@string/alert"
android:ringtoneType="alarm"
android:showDefault="false"
android:showSilent="false" />
<CheckBoxPreference android:key="vibrate"
android:title="@string/alarm_vibrate"/>
<com.android.alarmclock.RepeatPreference
android:key="setRepeat"
android:title="@string/alarm_repeat" />
<EditTextPreference android:key="label"
android:title="@string/label"
android:dialogTitle="@string/label" />
</PreferenceScreen>
Preference activity see here, note that, the links I referenced are not from the head revision.
Some highlights:
- Time is a plain
android.preference.Preference
, backed byTimePickerDialog
. Ringtone
is a customized implementation ofandroid.preference.RingtonePreference
.- Repeat is a customized implementation of
android.preference.ListPreferenc
e. - Alarms are managed by a static class com.android.alarmclock.Alarms which use Content Providers store the actual information.
- Holo theme is used by default since Android 4.0, on other Android version, you may see different theme. Note that the app implementation may also changed by different android version or device vendor.
How to implement robust alarm clock applications for Android 26+
After I have tried quite a few approaches I came to this conclusion: the only reliable way to execute the Code is to do it within the BroadcastReceiver or start a foreground service. Everything elso has proven to be unreliable.
So, back to big fat BroadcastReceivers!
Mimic layout of android alarm clock
Answering my own question.
It is a listview with custom list items. Each listitem is built up by several other views mostly linear views.
More details in the source code.
can i get access in my code to the alarm clock interface
No, sorry, there is no documented and supported API for setting alarm clock alarms. Moreover, that application may not exist on all Android devices, since it is not part of Android.
Related Topics
Android - Getting Audio to Play Through Earpiece
Creating a Directory in /Sdcard Fails
Android Take Screen Shot Programmatically
How to Solve the Install_Failed_Dexopt Error
Android M Camera Intent + Permission Bug
Removing Unused Strings During Proguard Optimisation
How to Open an Android Studio Project in Eclipse
Error Strictmode$Androidblockguardpolicy.Onnetwork
How to Force the Action Bar to Be at the Bottom in Ics
Visual Studio (2015) Emulator for Android Not Working - Xde.Exe - Exit Code 3
How to Get Access Token After User Is Signed in from Gmail in Android
Android:Static Fields and Memory Leaks
Register Application Class in Manifest
Neither User 10102 Nor Current Process Has Android.Permission.Read_Phone_State
Android Runtimeexception: Unable to Instantiate the Service
Android: Set Color of Checkbox
How to Make Grid-View Horizontally Scrollable in Android
How to Open/Display Documents(.Pdf, .Doc) Without External App