diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-12-28 22:24:57 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-12-28 22:24:57 -0800 |
commit | 5efc76957497b6537d6295d40f2633eef5e54b7b (patch) | |
tree | f5a2b3e4fe264e096ab14d5891206bb5c41e9cb8 /src/main/java/org/traccar/notificators | |
parent | 680df72d9dd0178b2bcec60c4e9c1c997c60630c (diff) | |
download | trackermap-server-5efc76957497b6537d6295d40f2633eef5e54b7b.tar.gz trackermap-server-5efc76957497b6537d6295d40f2633eef5e54b7b.tar.bz2 trackermap-server-5efc76957497b6537d6295d40f2633eef5e54b7b.zip |
Enable SMS API for commands
Diffstat (limited to 'src/main/java/org/traccar/notificators')
-rw-r--r-- | src/main/java/org/traccar/notificators/NotificatorSms.java | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/main/java/org/traccar/notificators/NotificatorSms.java b/src/main/java/org/traccar/notificators/NotificatorSms.java index d5c791eae..8124e40b1 100644 --- a/src/main/java/org/traccar/notificators/NotificatorSms.java +++ b/src/main/java/org/traccar/notificators/NotificatorSms.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2017 - 2020 Anton Tananaev (anton@traccar.org) * Copyright 2017 - 2018 Andrey Kunitsyn (andrey@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,27 +24,15 @@ import org.traccar.model.Position; import org.traccar.model.User; import org.traccar.notification.MessageException; import org.traccar.notification.NotificationFormatter; -import org.traccar.sms.SmsManager; public final class NotificatorSms extends Notificator { - private final SmsManager smsManager; - - public NotificatorSms() throws ClassNotFoundException, InstantiationException, IllegalAccessException { - final String smsClass = Context.getConfig().getString("notificator.sms.manager.class", ""); - if (smsClass.length() > 0) { - smsManager = (SmsManager) Class.forName(smsClass).newInstance(); - } else { - smsManager = Context.getSmsManager(); - } - } - @Override public void sendAsync(long userId, Event event, Position position) { final User user = Context.getPermissionsManager().getUser(userId); if (user.getPhone() != null) { Main.getInjector().getInstance(StatisticsManager.class).registerSms(); - smsManager.sendMessageAsync(user.getPhone(), + Context.getSmsManager().sendMessageAsync(user.getPhone(), NotificationFormatter.formatShortMessage(userId, event, position), false); } } @@ -54,7 +42,7 @@ public final class NotificatorSms extends Notificator { final User user = Context.getPermissionsManager().getUser(userId); if (user.getPhone() != null) { Main.getInjector().getInstance(StatisticsManager.class).registerSms(); - smsManager.sendMessageSync(user.getPhone(), + Context.getSmsManager().sendMessageSync(user.getPhone(), NotificationFormatter.formatShortMessage(userId, event, position), false); } } |