アンドロイドのアラームアプリケーションに保存されているアラームのリストを取得することは可能ですか?アラームアプリで設定したアラームを表示するだけのアプリを作っています。
ありがとう
これに関して、この投稿には良い説明があります。アプリがインストールされているすべてのデバイスにAlarmClockアプリがインストールされる保証はありません。たとえば、HTC電話の多くは、HTC独自の「世界時計」アプリに置き換えています。
ただし、ストックのAlarmClockアプリが存在する場合は、コンテンツプロバイダーからカーソルを取得できるはずです。例としてこのプロジェクトを参照してください。
final String tag_alarm = "tag_alarm";
Uri uri = Uri.parse("content://com.android.alarmclock/alarm");
Cursor c = getContentResolver().query(uri, null, null, null, null);
Log.i(tag_alarm, "no of records are " + c.getCount());
Log.i(tag_alarm, "no of columns are " + c.getColumnCount());
if (c != null) {
String names[] = c.getColumnNames();
for (String temp : names) {
System.out.println(temp);
}
if (c.moveToFirst()) {
do {
for (int j = 0; j < c.getColumnCount(); j++) {
Log.i(tag_alarm, c.getColumnName(j)
+ " which has value " + c.getString(j));
}
} while (c.moveToNext());
}
}
このコードを使用してください...そしてあなたはすべての詳細を得るでしょう。楽しみ!
デバッグの目的で、コンソールから「adbshelldumpsysalarm」を使用できます。