2013-04-08 2 views
1

나는 캘린더 이벤트 알림 작업을하고 있습니다. 안드로이드에는 기본 캘린더 이벤트 알리미가 없으므로 사용자는 다른 캘린더 앱을 설치합니다. 이제 이러한 앱은 알림 알림과 같은 알림 이벤트를 표시 할 때 다를 수 있습니다. 이제는이 이벤트 캘린더 앱에서 이벤트를 프로그래밍 방식으로 설정하고 시간에 알림을 표시하지 않고 팝업 메시지가 소리와 같은 경고음으로 표시되도록하고 싶습니다. 그 코드에서 site의 코드를 사용합니다. 그것의 작동하지만 알림의 형태로 알림을 보여주는.사용자 정의 알림 PoP보기 안드로이드에서보기

OnReceive :

void doReminderWork(Intent intent) { 


    Log.d("ReminderService", "Doing work."); 
    Long rowId = intent.getExtras().getLong(RemindersDbAdapter.KEY_ROWID); 

    NotificationManager mgr = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); 

    Intent notificationIntent = new Intent(this, ReminderEditActivity.class); 
    notificationIntent.putExtra(RemindersDbAdapter.KEY_ROWID, rowId); 

    PendingIntent pi = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_ONE_SHOT); 

    Notification note=new Notification(android.R.drawable.stat_sys_warning, getString(R.string.notify_new_task_message), System.currentTimeMillis()); 
    note.setLatestEventInfo(this, getString(R.string.notify_new_task_title), getString(R.string.notify_new_task_message), pi); 
    note.defaults |= Notification.DEFAULT_SOUND; 
    note.flags |= Notification.FLAG_AUTO_CANCEL; 


    int id = (int)((long)rowId); 
    mgr.notify(id, note); 


} 

지금 내가이 가능 할 수 있도록하는 방법 소리와 함께 할 경보와 같은 인터페이스를 팝업을 표시하려면 다음

는 코드입니다.

답변

1

doReminderWork()에서 알림을 표시하는 대신 대화 스타일 활동을 시작할 수 있습니다.

+0

인 텐트로 인해 나를 어떻게 안내 할 수 있습니까? – User42590

+1

Google에서 수천 가지 답변을 얻을 수 있습니다. "Android 대화 스타일 활동"및 "Android 서비스 시작 배경 활동". 여기에 빠른 참조 : http : //stackoverflow.com/questions/14292812/android-dialog-activity – Robin

+0

도움을 주셔서 감사합니다 .. :) – User42590