Skip to content

Commit

Permalink
Build against and target API 34
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
  • Loading branch information
chenxiaolong committed Oct 4, 2023
1 parent 525eb87 commit 709eaea
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ As the name alludes, BCR intends to be a basic as possible. The project will hav
* Needed to monitor the phone call state for starting and stopping the recording and gathering call information for the output filename.
* `RECORD_AUDIO` (**must be granted by the user**)
* Needed to capture the call audio stream.
* `FOREGROUND_SERVICE` (**automatically granted at install time**)
* `FOREGROUND_SERVICE`, `FOREGROUND_SERVICE_MICROPHONE` (**automatically granted at install time**)
* Needed to run the call recording service.
* `POST_NOTIFICATIONS` (**must be granted by the user on Android 13+**)
* Needed to show notifications.
Expand Down
6 changes: 3 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ val archiveDir = File(extraDir, "archive")
android {
namespace = "com.chiller3.bcr"

compileSdk = 33
buildToolsVersion = "33.0.2"
compileSdk = 34
buildToolsVersion = "34.0.0"

defaultConfig {
applicationId = "com.chiller3.bcr"
minSdk = 28
targetSdk = 33
targetSdk = 34
versionCode = gitVersionCode
versionName = gitVersionName
resourceConfigurations.addAll(listOf(
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Expand Down
16 changes: 13 additions & 3 deletions app/src/main/java/com/chiller3/bcr/RecorderTileService.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.chiller3.bcr

import android.app.PendingIntent
import android.content.Intent
import android.content.SharedPreferences
import android.os.Build
import android.service.quicksettings.Tile
import android.service.quicksettings.TileService
import android.util.Log
Expand Down Expand Up @@ -35,9 +37,17 @@ class RecorderTileService : TileService(), SharedPreferences.OnSharedPreferenceC
super.onClick()

if (!Permissions.haveRequired(this)) {
val intent = Intent(this, SettingsActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
startActivityAndCollapse(intent)
val intent = Intent(this, SettingsActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
startActivityAndCollapse(PendingIntent.getActivity(
this, 0, intent, PendingIntent.FLAG_IMMUTABLE))
} else {
@Suppress("DEPRECATION")
startActivityAndCollapse(intent)
}
} else {
prefs.isCallRecordingEnabled = !prefs.isCallRecordingEnabled
}
Expand Down

0 comments on commit 709eaea

Please sign in to comment.