Frage

I am working on Calender Events reminder . There is no native Calender events reminder in android so user install different calender apps . Now these apps can be different on reminding events like on reminder notifications can be shown. Now i want that i set an event programmatically in these event calender apps and on time reached not show any notification rather a pop up message will be shown with alarm like sound. At that i using a code from that site . Its working but it showing reminders in form of notifications.

Here is code:

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


}

Now i want to show a pop up interface like alarm do with sound so how it can be possible.

War es hilfreich?

Lösung

In your doReminderWork(), instead of displaying a notification, you can start an dialogue style activity.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top