Basic Android 12 compatibility + file names now include milliseconds (see #110)

master
y20k 2021-10-27 21:01:24 +02:00
parent 43067329e3
commit 0ef9ea8dbc
No known key found for this signature in database
GPG Key ID: 824D4259F41FAFF6
6 changed files with 16 additions and 14 deletions

View File

@ -4,14 +4,14 @@ apply plugin: 'kotlin-parcelize'
apply plugin: 'androidx.navigation.safeargs.kotlin'
android {
compileSdkVersion 30
compileSdkVersion 31
defaultConfig {
applicationId 'org.y20k.trackbook'
minSdkVersion 25
targetSdkVersion 30
versionCode 48
versionName '2.1.0'
targetSdkVersion 31
versionCode 49
versionName '2.1.1'
resConfigs "en", "da", "de", "fr", "hr", "id", "it", "ja", "nb-rNO", "nl", "pl", "pt-rBR", "ru", "sv", "tr", "zh-rCN"
}
@ -51,7 +51,7 @@ android {
dependencies {
// Kotlin
def coroutinesVersion = "1.5.0"
def coroutinesVersion = "1.5.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"

View File

@ -27,7 +27,9 @@
android:theme="@style/AppTheme">
<!-- MAIN ACTIVITY -->
<activity android:name=".MainActivity">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@ -51,8 +53,9 @@
android:name=".TrackingToggleTileService"
android:label="@string/quick_settings_tile_title_default"
android:icon="@drawable/ic_notification_icon_small_24dp"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
android:exported="true">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter>
</service>

View File

@ -210,7 +210,6 @@ class MapFragment : Fragment(), YesNoDialog.YesNoDialogListener, MapOverlayHelpe
private fun startTracking() {
// request activity recognition permission on Android Q+ if denied
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && ContextCompat.checkSelfPermission(activity as Context, Manifest.permission.ACTIVITY_RECOGNITION) == PackageManager.PERMISSION_DENIED) {
LogHelper.e(TAG, "permissions resume DING") // todo remove
startTrackingPermissionLauncher.launch(Manifest.permission.ACTIVITY_RECOGNITION)
} else {
// start service via intent so that it keeps running after unbind

View File

@ -58,7 +58,7 @@ object DateTimeHelper {
/* Create sortable string for date - used for filenames */
fun convertToSortableDateString(date: Date): String {
val dateFormat: SimpleDateFormat = SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.US)
val dateFormat: SimpleDateFormat = SimpleDateFormat("yyyy-MM-dd-HH-mm-ss-SSS", Locale.US)
return dateFormat.format(date)
}

View File

@ -107,13 +107,13 @@ class NotificationHelper(private val trackerService: TrackerService) {
/* Notification pending intents */
private val stopActionPendingIntent = PendingIntent.getService(
trackerService,14,
Intent(trackerService, TrackerService::class.java).setAction(Keys.ACTION_STOP),0)
Intent(trackerService, TrackerService::class.java).setAction(Keys.ACTION_STOP),PendingIntent.FLAG_IMMUTABLE)
private val resumeActionPendingIntent = PendingIntent.getService(
trackerService, 16,
Intent(trackerService, TrackerService::class.java).setAction(Keys.ACTION_RESUME),0)
Intent(trackerService, TrackerService::class.java).setAction(Keys.ACTION_RESUME),PendingIntent.FLAG_IMMUTABLE)
private val showActionPendingIntent: PendingIntent? = TaskStackBuilder.create(trackerService).run {
addNextIntentWithParentStack(Intent(trackerService, MainActivity::class.java))
getPendingIntent(10, PendingIntent.FLAG_UPDATE_CURRENT)
getPendingIntent(10, PendingIntent.FLAG_IMMUTABLE)
}

View File

@ -10,7 +10,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.2'
classpath 'com.android.tools.build:gradle:7.0.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigation_version"