Сравнить коммиты
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
cbfe90757d | ||
|
|
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 51
|
||||||
versionName '5.12'
|
versionName '5.14'
|
||||||
}
|
}
|
||||||
|
|
||||||
lintOptions {
|
lintOptions {
|
||||||
|
|||||||
@@ -20,6 +20,10 @@
|
|||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
android:name=".MainApplication">
|
android:name=".MainApplication">
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="google_analytics_adid_collection_enabled"
|
||||||
|
android:value="false" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:launchMode="singleTask" />
|
android:launchMode="singleTask" />
|
||||||
|
|||||||
@@ -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() {
|
||||||
locationManager.requestLocationUpdates(
|
try {
|
||||||
distance > 0 || angle > 0 ? MINIMUM_INTERVAL : interval, 0,
|
locationManager.requestLocationUpdates(
|
||||||
getCriteria(preferences.getString(MainFragment.KEY_ACCURACY, "medium")),
|
distance > 0 || angle > 0 ? MINIMUM_INTERVAL : interval, 0,
|
||||||
this, Looper.myLooper());
|
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) {
|
public static Criteria getCriteria(String accuracy) {
|
||||||
|
|||||||
@@ -111,28 +111,32 @@ 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"));
|
||||||
|
|
||||||
Location location = locationManager.getLastKnownLocation(locationManager.getBestProvider(criteria, true));
|
try {
|
||||||
if (location != null) {
|
Location location = locationManager.getLastKnownLocation(locationManager.getBestProvider(criteria, true));
|
||||||
sendAlarmLocation(location);
|
if (location != null) {
|
||||||
} else {
|
sendAlarmLocation(location);
|
||||||
locationManager.requestSingleUpdate(criteria, new LocationListener() {
|
} else {
|
||||||
@Override
|
locationManager.requestSingleUpdate(criteria, new LocationListener() {
|
||||||
public void onLocationChanged(Location location) {
|
@Override
|
||||||
sendAlarmLocation(location);
|
public void onLocationChanged(Location location) {
|
||||||
}
|
sendAlarmLocation(location);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStatusChanged(String provider, int status, Bundle extras) {
|
public void onStatusChanged(String provider, int status, Bundle extras) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onProviderEnabled(String provider) {
|
public void onProviderEnabled(String provider) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onProviderDisabled(String provider) {
|
public void onProviderDisabled(String provider) {
|
||||||
}
|
}
|
||||||
}, Looper.myLooper());
|
}, 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");
|
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
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user