2011-12-28 2 views

답변

6

DeskClock 응용 프로그램 (이전 AlarmClock 응용 프로그램을 대체 함)은 Alarm Manager를 사용하여 경보를 설정합니다. 불행하게도 알람 관리자에서 생성 한 PendingIntent를 모르는 경우 알람 관리자에서 기존 알람을 읽을 수 없습니다. DeskClock은 이러한 PendingIntents와 다른 알람 정보를 내부 데이터베이스에 저장합니다. 그러나 마지막으로 알람을 설정하거나 제거한 시간을 확인할 수있는 다른 방법이 있습니다.

DeskClock은 상태 표시 줄 아이콘 (켜기/끄기를 나타내는 alarmSet)과 다음 방송 수신기를 사용하여받을 수 있습니다 업데이트 Systems.Settings.NEXT_ALARM_FORMATTED :

<receiver android:name=".TestReceiver"> 
    <intent-filter> 
     <action android:name="android.intent.action.ALARM_CHANGED"></action> 
    </intent-filter> 
</receiver> 
+0

당신이 밀리 세컨드로 변경하는 방법을 알고 계십니까 :

private static final String tag = "TestReceiver"; @Override public void onReceive(Context context, Intent intent) { Log.d(tag, "intent=" + intent); Boolean message = intent.getBooleanExtra("alarmSet",false); Log.d(tag, "alarmSet: " + message); Log.d(tag, "next alarm: " + Settings.System.getString(context.getContentResolver(),android.provider.Settings.System.NEXT_ALARM_FORMATTED)); } 

과의 AndroidManifest.xml에 다음과 텐트 필터와

? Settings.System.getString (context.getContentResolver(), android.provider.Settings.System.NEXT_ALARM_FORMATTED) – MobileMon

+0

DeskClock에서는 시간을 밀리 초 단위로 설정할 수 없기 때문에 밀리 초 단위로 시간을 읽는 것은 유용하지 않습니다. 밀리 초 단위로 작업하는 경우, 수행하려는 작업에 따라 Calendar.getTimeInMillis() 또는 System.currentTimeMillis()가 더 유용 할 수 있습니다. – Gerrit

+0

참고 - Lollipop에서 더 이상 작동하지 않습니다. 의도는 비공개 였고 이제는 액세스가 제거되었습니다. –

관련 문제