Method sendLocationToTelegram is now responsible for checking if internet is available.
This commit is contained in:
parent
32a4467bce
commit
44a01332ae
|
|
@ -170,17 +170,17 @@ public class LocationLoggingService extends Service implements LocationListener
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastLocation = newLocation;
|
||||||
|
sendLocationToTelegram(lastLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendLocationToTelegram(Location location) {
|
||||||
if(!internetAvailable)
|
if(!internetAvailable)
|
||||||
{
|
{
|
||||||
Log.i(TAG, "Internet is not available.");
|
Log.i(TAG, "Internet is not available.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastLocation = newLocation;
|
|
||||||
sendLocationToTelegram(lastLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void sendLocationToTelegram(Location location){
|
|
||||||
String botToken = getResources().getString(R.string.telegramToken);
|
String botToken = getResources().getString(R.string.telegramToken);
|
||||||
String telegramChat = getResources().getString(R.string.telegramChat);
|
String telegramChat = getResources().getString(R.string.telegramChat);
|
||||||
TelegramBot bot = new TelegramBot(botToken);
|
TelegramBot bot = new TelegramBot(botToken);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue