I have Cordova app with plugin for local notification. Problem is that cancelAll()
does not wait until it is finished so it is still deleting while I am adding my new messages.
How do I synchronize threads to make cancelAll()
wait?
Some related code 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;
}