Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/213.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android中的自定义提醒弹出视图_Android_Android Alarms_Android Event - Fatal编程技术网

Android中的自定义提醒弹出视图

Android中的自定义提醒弹出视图,android,android-alarms,android-event,Android,Android Alarms,Android Event,我正在制作日历事件提醒。android中没有本机日历事件提醒,所以用户可以安装不同的日历应用程序。现在,这些应用程序可以在提醒事件上有所不同,比如可以显示提醒通知。现在,我希望我在这些事件日历应用程序中以编程方式设置一个事件,并且在到达的时间不显示任何通知,而是会显示一条带有类似警报声的弹出消息。在那个时候,我使用了一个来自那个的代码。它可以工作,但它以通知的形式显示提醒 以下是代码: 收到: void doReminderWork(Intent intent) { Log.d(

我正在制作日历事件提醒。android中没有本机日历事件提醒,所以用户可以安装不同的日历应用程序。现在,这些应用程序可以在提醒事件上有所不同,比如可以显示提醒通知。现在,我希望我在这些事件日历应用程序中以编程方式设置一个事件,并且在到达的时间不显示任何通知,而是会显示一条带有类似警报声的弹出消息。在那个时候,我使用了一个来自那个的代码。它可以工作,但它以通知的形式显示提醒

以下是代码:

收到:

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


}

现在我想显示一个弹出界面,如alarm do with sound,这样就可以了。

在doReminderWork()中,您可以启动对话式活动,而不是显示通知。

在doReminderWork()中,而不是显示通知,您可以启动对话式活动。

请您指导我如何通过谷歌“Android对话式活动”和“Android从后台服务启动活动”获得数千个答案。这里有一个快速参考:请你能告诉我,由于你的意图,你如何通过谷歌“Android对话式活动”和“Android启动后台服务活动”获得数千个答案。这里有一个快速参考: