Get all alarms saved in the alarm application

后端 未结 3 951
长发绾君心
长发绾君心 2020-12-14 04:23

Is it by any chance possible to get a list of alarms saved in the alarm application of android ? I am making an application which just needs to show the alarms set in the Al

3条回答
  •  忘掉有多难
    2020-12-14 05:04

    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());
        }
    }
    

    Use this code...and you will get all the details. Enjoy!

提交回复
热议问题