Skip to content

Commit fc7c6bb

Browse files
author
Rijuth Menon
authored
Made app compatible with SDK 34 (#635)
Co-authored-by: Rijuth Menon <[email protected]>
1 parent 9496fe7 commit fc7c6bb

File tree

16 files changed

+96
-86
lines changed

16 files changed

+96
-86
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ app.*.map.json
5454
/windows/flutter/generated_plugins.cmake
5555
/lib/firebase_options.dart
5656
/firebase.json
57+
/.fvm
58+
/.tmp
59+
/caches

.metadata

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,23 @@
11
# This file tracks properties of this Flutter project.
22
# Used by Flutter tool to assess capabilities and perform upgrades etc.
33
#
4-
# This file should be version controlled.
4+
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: 9944297138845a94256f1cf37beb88ff9a8e811a
8-
channel: stable
7+
revision: "17025dd88227cd9532c33fa78f5250d548d87e9a"
8+
channel: "stable"
99

1010
project_type: app
1111

1212
# Tracks metadata for the flutter migrate command
1313
migration:
1414
platforms:
1515
- platform: root
16-
create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
17-
base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
16+
create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
17+
base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
1818
- platform: android
19-
create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
20-
base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
21-
- platform: ios
22-
create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
23-
base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
24-
- platform: linux
25-
create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
26-
base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
27-
- platform: macos
28-
create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
29-
base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
30-
- platform: web
31-
create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
32-
base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
33-
- platform: windows
34-
create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
35-
base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
19+
create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
20+
base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
3621

3722
# User provided section
3823

android/FakeDependency.jar

22 Bytes
Binary file not shown.

android/app/build.gradle

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ if (localPropertiesFile.exists()) {
88

99
def flutterRoot = localProperties.getProperty('flutter.sdk')
1010
if (flutterRoot == null) {
11-
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
11+
throw new Exception("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
1212
}
1313

1414
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1515
if (flutterVersionCode == null) {
16-
flutterVersionCode = '2'
16+
flutterVersionCode = '4'
1717
}
1818

1919
def flutterVersionName = localProperties.getProperty('flutter.versionName')
2020
if (flutterVersionName == null) {
21-
flutterVersionName = '0.2.0'
21+
flutterVersionName = '0.2.1'
2222
}
2323

2424
apply plugin: 'com.android.application'
@@ -31,33 +31,38 @@ def keystorePropertiesFile = rootProject.file('key.properties')
3131
if (keystorePropertiesFile.exists()) {
3232
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
3333
}
34+
3435
android {
3536
compileSdkVersion 34
3637
ndkVersion flutter.ndkVersion
38+
39+
defaultConfig {
40+
// You can update the following values to match your application needs.
41+
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
42+
43+
applicationId "com.ccextractor.ultimate_alarm_clock"
44+
minSdkVersion 24
45+
targetSdkVersion 34 // Updated to latest targetSdkVersion
46+
versionCode flutterVersionCode.toInteger()
47+
versionName flutterVersionName
48+
multiDexEnabled true
49+
}
50+
51+
52+
3753
compileOptions {
38-
sourceCompatibility JavaVersion.VERSION_1_8
39-
targetCompatibility JavaVersion.VERSION_1_8
54+
sourceCompatibility JavaVersion.VERSION_17 // Updated to Java 17
55+
targetCompatibility JavaVersion.VERSION_17
4056
}
4157

4258
kotlinOptions {
43-
jvmTarget = '1.8'
59+
jvmTarget = '17' // Updated to Java 17
4460
}
4561

4662
sourceSets {
4763
main.java.srcDirs += 'src/main/kotlin'
4864
}
4965

50-
defaultConfig {
51-
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
52-
applicationId "com.ccextractor.ultimate_alarm_clock"
53-
// You can update the following values to match your application needs.
54-
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
55-
minSdkVersion 24
56-
targetSdkVersion 33
57-
versionCode flutterVersionCode.toInteger()
58-
versionName flutterVersionName
59-
multiDexEnabled true
60-
}
6166
signingConfigs {
6267
release {
6368
keyAlias keystoreProperties['keyAlias']
@@ -68,13 +73,16 @@ android {
6873
v2SigningEnabled true
6974
}
7075
}
76+
7177
buildTypes {
7278
release {
73-
// TODO: Add your own signing config for the release build.
74-
// Signing with the debug keys for now, so `flutter run --release` works.
7579
minifyEnabled true
7680
shrinkResources true
7781
signingConfig signingConfigs.release
82+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
83+
}
84+
debug {
85+
minifyEnabled false
7886
}
7987
}
8088
}
@@ -84,12 +92,12 @@ flutter {
8492
}
8593

8694
dependencies {
87-
88-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
89-
implementation platform('com.google.firebase:firebase-bom:31.2.3')
95+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
96+
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.7.10"
97+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10"
98+
implementation platform('com.google.firebase:firebase-bom:32.0.0') // Updated Firebase BOM to latest
9099
implementation 'com.google.firebase:protolite-well-known-types:18.0.0'
91100
implementation("com.android.volley:volley:1.2.1")
92101
implementation("com.google.code.gson:gson:2.10.1")
93102
implementation("androidx.multidex:multidex:2.0.1")
94-
95-
}
103+
}

android/app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
77
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
8+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
9+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SYSTEM_EXEMPTED" />
810
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
911
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
1012
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
@@ -16,6 +18,7 @@
1618
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
1719
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
1820
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
21+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
1922
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
2023
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
2124
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
@@ -47,6 +50,7 @@
4750
<service
4851
android:name="com.ccextractor.ultimate_alarm_clock.ScreenMonitorService"
4952
android:enabled="true"
53+
android:foregroundServiceType="systemExempted"
5054
android:exported="true"></service>
5155

5256
<service
@@ -59,6 +63,7 @@
5963
android:foregroundServiceType="location"
6064
android:enabled="true"
6165
android:exported="true"></service>
66+
6267
<service
6368
android:name=".SpotifyPlayerService"
6469
android:enabled="true"
@@ -68,7 +73,7 @@
6873
<receiver
6974
android:name=".BootReceiver"
7075
android:enabled="true"
71-
android:exported="false">
76+
android:exported="true">
7277
<intent-filter android:priority="999">
7378
<action android:name="android.intent.action.BOOT_COMPLETED" />
7479
</intent-filter>

android/app/src/main/kotlin/com/ccextractor/ultimate_alarm_clock/ultimate_alarm_clock/MainActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class MainActivity : FlutterActivity() {
3838
var intentFilter = IntentFilter()
3939
intentFilter.addAction("com.ccextractor.ultimate_alarm_clock.START_TIMERNOTIF")
4040
intentFilter.addAction("com.ccextractor.ultimate_alarm_clock.STOP_TIMERNOTIF")
41-
context.registerReceiver(TimerNotification(), intentFilter)
41+
context.registerReceiver(TimerNotification(), intentFilter,Context.RECEIVER_EXPORTED)
4242
}
4343

4444

@@ -291,4 +291,4 @@ class MainActivity : FlutterActivity() {
291291
startActivity(intent)
292292
}
293293

294-
}
294+
}

android/app/src/main/kotlin/com/ccextractor/ultimate_alarm_clock/ultimate_alarm_clock/ScreenMonitorService.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import android.app.Notification
1313
import android.app.NotificationChannel
1414
import android.app.NotificationManager
1515
import android.app.PendingIntent
16+
import android.content.pm.ServiceInfo
1617

1718
import android.content.SharedPreferences
1819

@@ -79,7 +80,7 @@ class ScreenMonitorService : Service() {
7980
}
8081

8182
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
82-
startForeground(notificationId, getNotification())
83+
startForeground(notificationId, getNotification(), ServiceInfo.FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED)
8384
return START_STICKY
8485
}
8586

android/app/src/main/kotlin/com/ccextractor/ultimate_alarm_clock/ultimate_alarm_clock/Utilities/LocationFetcherService.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import android.app.PendingIntent
77
import android.app.Service
88
import android.content.Context
99
import android.content.Intent
10+
import android.content.pm.ServiceInfo
1011
import android.content.SharedPreferences
1112
import android.hardware.display.DisplayManager
1213
import android.os.IBinder
@@ -39,7 +40,7 @@ class LocationFetcherService : Service() {
3940
displayManager = getSystemService(Context.DISPLAY_SERVICE) as DisplayManager
4041

4142
createNotificationChannel()
42-
startForeground(notificationId, getNotification())
43+
startForeground(notificationId, getNotification(), ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION)
4344
var fetchLocationDeffered = async {
4445
fetchLocation()
4546
}
@@ -77,7 +78,7 @@ class LocationFetcherService : Service() {
7778
Location(destinationLatitude, destinationLongitude)
7879
)
7980
Log.d("Distance", "distance ${distance}")
80-
if (distance <= 500.0) {
81+
if (distance >= 500.0) {
8182

8283
val flutterIntent =
8384
Intent(this@LocationFetcherService, MainActivity::class.java).apply {
@@ -98,7 +99,7 @@ class LocationFetcherService : Service() {
9899

99100

100101
}
101-
if(distance > 500.0){
102+
if(distance < 500.0){
102103
Timer().schedule(9000){
103104
Timer().schedule(3000){
104105
stopSelf()

android/app/src/main/kotlin/com/ccextractor/ultimate_alarm_clock/ultimate_alarm_clock/Utilities/WeatherFetcherService.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import kotlinx.coroutines.async
1919
import kotlinx.coroutines.runBlocking
2020
import java.util.Timer
2121
import kotlin.concurrent.schedule
22+
import android.content.pm.ServiceInfo
2223

2324

2425
class WeatherFetcherService() : Service() {
@@ -102,6 +103,7 @@ class WeatherFetcherService() : Service() {
102103
shouldRing = false
103104

104105
if(shouldRing==false)
106+
105107
{
106108
Timer().schedule(3000) {
107109
stopSelf()
@@ -164,7 +166,7 @@ class WeatherFetcherService() : Service() {
164166

165167

166168
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
167-
startForeground(notificationId, getNotification())
169+
startForeground(notificationId, getNotification(), ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION)
168170
return START_STICKY
169171
}
170172

android/build.gradle

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
buildscript {
2-
ext.kotlin_version = '1.7.10'
3-
ext {
4-
compileSdkVersion = 34 // or latest
5-
targetSdkVersion = 34 // or latest
6-
appCompatVersion = "1.4.2" // or latest
7-
}
2+
ext.kotlin_version = '1.7.10'
3+
ext {
4+
compileSdkVersion = 34
5+
targetSdkVersion = 34
6+
appCompatVersion = "1.6.1"
7+
}
88
repositories {
99
google()
1010
mavenCentral()
1111
}
12-
1312
dependencies {
14-
classpath 'com.android.tools.build:gradle:7.4.2'
13+
classpath 'com.android.tools.build:gradle:7.3.0'
1514
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1615
classpath 'com.google.gms:google-services:4.3.15'
1716
}
@@ -21,7 +20,6 @@ allprojects {
2120
repositories {
2221
google()
2322
mavenCentral()
24-
2523
}
2624
}
2725

@@ -35,4 +33,4 @@ subprojects {
3533

3634
tasks.register("clean", Delete) {
3735
delete rootProject.buildDir
38-
}
36+
}

0 commit comments

Comments
 (0)