Android 10 compatibility

This commit is contained in:
y20k 2019-09-10 17:38:10 +02:00
parent 218bc19678
commit b09259594f
No known key found for this signature in database
GPG key ID: 824D4259F41FAFF6
4 changed files with 13 additions and 10 deletions

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.y20k.trackbook"> package="org.y20k.trackbook">
<!-- EXCLUDE NON-GPS DEVICES --> <!-- EXCLUDE NON-GPS DEVICES -->
@ -23,7 +24,8 @@
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/TrackbookAppTheme"> android:theme="@style/TrackbookAppTheme"
tools:ignore="GoogleAppIndexingWarning">
<!-- MAIN ACTIVITY --> <!-- MAIN ACTIVITY -->
<activity <activity
@ -42,6 +44,7 @@
<!-- TRACKER SERVICE --> <!-- TRACKER SERVICE -->
<service <service
android:name=".TrackerService" android:name=".TrackerService"
android:foregroundServiceType="location"
android:exported="false"> android:exported="false">
<intent-filter> <intent-filter>
<action android:name="org.y20k.trackbook.action.START" /> <action android:name="org.y20k.trackbook.action.START" />

View file

@ -39,6 +39,9 @@ import android.os.IBinder;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.widget.Toast; import android.widget.Toast;
import androidx.core.app.NotificationCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.y20k.trackbook.core.Track; import org.y20k.trackbook.core.Track;
import org.y20k.trackbook.helpers.LocationHelper; import org.y20k.trackbook.helpers.LocationHelper;
import org.y20k.trackbook.helpers.LogHelper; import org.y20k.trackbook.helpers.LogHelper;
@ -48,9 +51,6 @@ import org.y20k.trackbook.helpers.TrackbookKeys;
import java.util.List; import java.util.List;
import androidx.core.app.NotificationCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import static android.hardware.Sensor.TYPE_STEP_COUNTER; import static android.hardware.Sensor.TYPE_STEP_COUNTER;
@ -414,7 +414,7 @@ public class TrackerService extends Service implements TrackbookKeys, SensorEven
float averageSpeed = 0f; float averageSpeed = 0f;
// compute average speed if new location came from network provider // compute average speed if new location came from network provider
if (trackSize > 1 && mCurrentBestLocation.getProvider().equals(LocationManager.NETWORK_PROVIDER)) { if (trackSize > 1 && LocationManager.NETWORK_PROVIDER.equals(mCurrentBestLocation.getProvider())) {
Location firstWayPoint = mTrack.getWayPointLocation(0); Location firstWayPoint = mTrack.getWayPointLocation(0);
float distance = firstWayPoint.distanceTo(previousLocation); float distance = firstWayPoint.distanceTo(previousLocation);
long timeDifference = previousLocation.getElapsedRealtimeNanos() - firstWayPoint.getElapsedRealtimeNanos(); long timeDifference = previousLocation.getElapsedRealtimeNanos() - firstWayPoint.getElapsedRealtimeNanos();

View file

@ -8,7 +8,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.4.2' classpath 'com.android.tools.build:gradle:3.5.0'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
} }
@ -27,8 +27,8 @@ allprojects {
versionCode = 37 versionCode = 37
versionName = '1.2.3' versionName = '1.2.3'
compileSdkVersion = 28 compileSdkVersion = 29
targetSdkVersion = 27 targetSdkVersion = 29
minSdkVersion = 22 minSdkVersion = 22
constraintlayoutVersion = '1.1.3' constraintlayoutVersion = '1.1.3'

View file

@ -1,6 +1,6 @@
#Wed Apr 24 13:40:20 CEST 2019 #Mon Sep 09 18:28:26 CEST 2019
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip