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