diff --git a/app/src/main/java/com/proculite/logmylocation/LocationLoggingService.java b/app/src/main/java/com/proculite/logmylocation/LocationLoggingService.java index 5f938a1..815a91e 100644 --- a/app/src/main/java/com/proculite/logmylocation/LocationLoggingService.java +++ b/app/src/main/java/com/proculite/logmylocation/LocationLoggingService.java @@ -170,17 +170,17 @@ public class LocationLoggingService extends Service implements LocationListener return; } + lastLocation = newLocation; + sendLocationToTelegram(lastLocation); + } + + public void sendLocationToTelegram(Location location) { if(!internetAvailable) { Log.i(TAG, "Internet is not available."); return; } - lastLocation = newLocation; - sendLocationToTelegram(lastLocation); - } - - public void sendLocationToTelegram(Location location){ String botToken = getResources().getString(R.string.telegramToken); String telegramChat = getResources().getString(R.string.telegramChat); TelegramBot bot = new TelegramBot(botToken);