我有带有本地通知插件的 Cordova 应用程序。问题是它cancelAll()
不会等到它完成,所以在我添加新消息时它仍在删除。
如何同步线程以cancelAll()
等待?
一些相关代码AlarmHelper::cancelAll()
/**
* @see LocalNotification#cancelAllNotifications()
*/
public boolean cancelAll(SharedPreferences alarmSettings) {
final Map<String, ?> allAlarms = alarmSettings.getAll();
final Set<String> alarmIds = allAlarms.keySet();
for (String alarmId : alarmIds) {
Log.d(LocalNotification.PLUGIN_NAME, "Canceling notification with id: " + alarmId);
String alarmInt = alarmId;
cancelAlarm(alarmInt);
}
return true;
}