Сравнить коммиты
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
a9f4390ae4 | ||
|
|
8a938701c8 | ||
|
|
2319834c5b |
@@ -9,8 +9,8 @@ android {
|
|||||||
buildConfigField "boolean", "HIDDEN_APP", "false"
|
buildConfigField "boolean", "HIDDEN_APP", "false"
|
||||||
minSdkVersion 15
|
minSdkVersion 15
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 49
|
versionCode 50
|
||||||
versionName '5.12'
|
versionName '5.13'
|
||||||
}
|
}
|
||||||
|
|
||||||
lintOptions {
|
lintOptions {
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import android.os.Bundle;
|
|||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class PositionProvider implements LocationListener {
|
public class PositionProvider implements LocationListener {
|
||||||
|
|
||||||
@@ -69,10 +70,14 @@ public class PositionProvider implements LocationListener {
|
|||||||
|
|
||||||
@SuppressLint("MissingPermission")
|
@SuppressLint("MissingPermission")
|
||||||
public void startUpdates() {
|
public void startUpdates() {
|
||||||
|
try {
|
||||||
locationManager.requestLocationUpdates(
|
locationManager.requestLocationUpdates(
|
||||||
distance > 0 || angle > 0 ? MINIMUM_INTERVAL : interval, 0,
|
distance > 0 || angle > 0 ? MINIMUM_INTERVAL : interval, 0,
|
||||||
getCriteria(preferences.getString(MainFragment.KEY_ACCURACY, "medium")),
|
getCriteria(preferences.getString(MainFragment.KEY_ACCURACY, "medium")),
|
||||||
this, Looper.myLooper());
|
this, Looper.myLooper());
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
Toast.makeText(context, e.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Criteria getCriteria(String accuracy) {
|
public static Criteria getCriteria(String accuracy) {
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ public class ShortcutActivity extends AppCompatActivity {
|
|||||||
Criteria criteria = PositionProvider.getCriteria(
|
Criteria criteria = PositionProvider.getCriteria(
|
||||||
preferences.getString(MainFragment.KEY_ACCURACY, "medium"));
|
preferences.getString(MainFragment.KEY_ACCURACY, "medium"));
|
||||||
|
|
||||||
|
try {
|
||||||
Location location = locationManager.getLastKnownLocation(locationManager.getBestProvider(criteria, true));
|
Location location = locationManager.getLastKnownLocation(locationManager.getBestProvider(criteria, true));
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
sendAlarmLocation(location);
|
sendAlarmLocation(location);
|
||||||
@@ -134,6 +135,9 @@ public class ShortcutActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}, Looper.myLooper());
|
}, Looper.myLooper());
|
||||||
}
|
}
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendAlarmLocation(Location location) {
|
private void sendAlarmLocation(Location location) {
|
||||||
|
|||||||
@@ -78,15 +78,18 @@ public class TrackingService extends Service {
|
|||||||
Log.i(TAG, "service create");
|
Log.i(TAG, "service create");
|
||||||
StatusActivity.addMessage(getString(R.string.status_service_create));
|
StatusActivity.addMessage(getString(R.string.status_service_create));
|
||||||
|
|
||||||
|
startForeground(NOTIFICATION_ID, createNotification(this));
|
||||||
|
|
||||||
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
||||||
&& ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
&& ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
||||||
trackingController = new TrackingController(this);
|
trackingController = new TrackingController(this);
|
||||||
trackingController.start();
|
trackingController.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
startForeground(NOTIFICATION_ID, createNotification(this));
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||||
ContextCompat.startForegroundService(this, new Intent(this, HideNotificationService.class));
|
ContextCompat.startForegroundService(this, new Intent(this, HideNotificationService.class));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBinder onBind(Intent intent) {
|
public IBinder onBind(Intent intent) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user