I am trying to get next alarm clock time on android. I use two known methods:
1: ( ( AlarmManager )Global.Context.getSystemService(Context.ALARM_SERVICE) ).getNextAlarmClock().getTriggerTime() // for SDK API 21+
2: Settings.System.getString(Global.Context.getContentResolver(), Settings.System.NEXT_ALARM_FORMATTED) // for SDK API 20-
This work ok on most part of devices. But on some devices with MIUI the results are wrong (for both methods 1 or 2). The results seem to be random without any consistence with alarm clock. May be these result are corresponding to calendar events notifications. But not with alarm clock.
The users of my app, that encounter such a problem, report me about other apps that show next alarm clock time correct. So I know that the solution exists.