Android -已存在挂起的垂直同步事件

bqjvbblv  于 2022-12-25  发布在  Android
关注(0)|答案(1)|浏览(137)

我有三个服务。
一个月一次,一个月一次,一个月二次
我用这个代码来初始化它们:

morning_notification = new Intent();
    morning_notification.setClass(this, MorningNotification.class);

    dinner_notification = new Intent();
    dinner_notification.setClass(this, DinnerNotification.class);

    evening_notification = new Intent();
    evening_notification.setClass(this, EveningNotification.class);

在那之后,我这样使用它们:

... 
    /* Запуск сервера */
                        startService(morning_notification);
    ...
 ... 
    /* Запуск сервера */
                        startService(dinner_notification);
    ...
 ... 
    /* Запуск сервера */
                        startService(evening_notification);
    ...

但是,问题是只有MorningNotification服务在工作。但是我需要启动所有三个服务。
我有这个日志:

W/Choreographer﹕ Already have a pending vsync event.  There should only be one at a time.
12-09 09:35:03.025  12961-12961/ru.mentalcalculation E/ViewRootImpl﹕ sendUserActionEvent() mView == null
12-09 09:35:07.895  12961-12961/ru.mentalcalculation W/Choreographer﹕ Already have a pending vsync event.  There should only be one at a time.
12-09 09:35:07.895  12961-12961/ru.mentalcalculation E/ViewRootImpl﹕ sendUserActionEvent() mView == null
12-09 09:35:12.845  12961-12961/ru.mentalcalculation W/Choreographer﹕ Already have a pending vsync event.  There should only be one at a time.
12-09 09:35:12.845  12961-12961/ru.mentalcalculation E/ViewRootImpl﹕ sendUserActionEvent() mView == null
zkure5ic

zkure5ic1#

您不能同时启动这三项服务。我建议您在调用下一项服务之前先完成晨间意图。这是为了避免不受控制的分支可能会失控。您可以检查:http://developer.android.com/reference/android/app/PendingIntent.html

相关问题