Skip to content

Screen Activity Monitor (Anti-Disturbance Feature) and package rename to com.ccextractor.ultimate_alarm_clock #574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileSdkVersion rootProject.ext.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -44,7 +49,7 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.ultimate_alarm_clock"
applicationId "com.ccextractor.ultimate_alarm_clock"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 23
Expand All @@ -53,14 +58,21 @@ android {
versionName flutterVersionName
multiDexEnabled true
}

signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
minifyEnabled true
shrinkResources true
signingConfig signingConfigs.debug
signingConfig signingConfigs.release
}
}
}
Expand Down
63 changes: 54 additions & 9 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,86 @@
{
"project_info": {
"project_number": "951082036741",
"project_id": "ulticock-c13a2",
"storage_bucket": "ulticock-c13a2.appspot.com"
"project_number": "127901953489",
"project_id": "uac2-7d0f9",
"storage_bucket": "uac2-7d0f9.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:951082036741:android:45bc3756a62c480f71766c",
"mobilesdk_app_id": "1:127901953489:android:1c0dea09b93c2b573fc4f0",
"android_client_info": {
"package_name": "com.ccextractor.ultimate_alarm_clock"
}
},
"oauth_client": [
{
"client_id": "127901953489-132kstrs7vl5j5jnubjktu0qodgcn9ml.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.ccextractor.ultimate_alarm_clock",
"certificate_hash": "30bf4033c248d9a3ecccbe3615c8baec5f4ed31a"
}
},
{
"client_id": "127901953489-hgjdtpa0jo2gdrh5vl3s0km66g81v66o.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.ccextractor.ultimate_alarm_clock",
"certificate_hash": "5463a1d268da62e33b869a41760d31cd5ffc1e5d"
}
},
{
"client_id": "127901953489-lnsmj324f5eutudkjvaidotj99bq1l47.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCEaWUdYF_PnGFu0uJL8Zl_BlT8knDVeHg"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "127901953489-lnsmj324f5eutudkjvaidotj99bq1l47.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:127901953489:android:02cb55ff82004bb03fc4f0",
"android_client_info": {
"package_name": "com.example.ultimate_alarm_clock"
}
},
"oauth_client": [
{
"client_id": "951082036741-q9jfduqcvikipre5ubf7774o9b2l822h.apps.googleusercontent.com",
"client_id": "127901953489-09r774m4cup6mlt341i2v9fpbhngmq2h.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.example.ultimate_alarm_clock",
"certificate_hash": "af289e1ac935477a575746d95dea1c78156db532"
"certificate_hash": "30bf4033c248d9a3ecccbe3615c8baec5f4ed31a"
}
},
{
"client_id": "951082036741-5c8vh71vidd27rjihimnemnbdquq1tp2.apps.googleusercontent.com",
"client_id": "127901953489-lnsmj324f5eutudkjvaidotj99bq1l47.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCEgfAAOgj5oLlX7LtXn_vCoW7AkMj7Qv4"
"current_key": "AIzaSyCEaWUdYF_PnGFu0uJL8Zl_BlT8knDVeHg"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "951082036741-5c8vh71vidd27rjihimnemnbdquq1tp2.apps.googleusercontent.com",
"client_id": "127901953489-lnsmj324f5eutudkjvaidotj99bq1l47.apps.googleusercontent.com",
"client_type": 3
}
]
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ultimate_alarm_clock">
package="com.ccextractor.ultimate_alarm_clock">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
Expand Down
99 changes: 51 additions & 48 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.ultimate_alarm_clock">
package="com.ccextractor.ultimate_alarm_clock">

<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
Expand All @@ -13,95 +14,97 @@
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_SETTINGS"
tools:ignore="ProtectedPermissions" />

<queries>
<intent>
<action android:name="android.intent.action.VIEW" />

<data android:scheme="https" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />

<data android:scheme="http" />
</intent>
</queries>

<application
tools:replace="android:label"
android:label="Ultimate Alarm Clock"
android:name="${applicationName}"
android:icon="@mipmap/launcher_icon">

android:icon="@mipmap/launcher_icon"
android:label="Ultimate Alarm Clock"
tools:replace="android:label">
<service
android:name="com.pravera.flutter_foreground_task.service.ForegroundService" />
android:name=".ScreenMonitorService"
android:enabled="true"
android:exported="true"></service>
<service android:name="com.pravera.flutter_foreground_task.service.ForegroundService" />

<receiver android:name=".BootReceiver"
<receiver
android:name=".BootReceiver"
android:enabled="true"
android:exported="false">
<intent-filter>
<intent-filter android:priority="999">
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>

<receiver
android:name=".TimerNotification"
android:enabled="true"
android:exported="false">
</receiver>


android:exported="false"></receiver>
<receiver
android:name=".AlarmReceiver"
android:enabled="true"
android:exported="false">
</receiver>

android:exported="false"></receiver>
<receiver
android:name=".TimerReceiver"
android:enabled="true"
android:exported="false">

</receiver>

android:exported="false"></receiver>

<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:exported="true"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as

<!--
Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
to determine the Window background behind the Flutter UI.
-->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme" />

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
/>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:theme="@style/LaunchTheme"
android:windowSoftInputMode="adjustResize" />
<!--
Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java
-->
<meta-data
android:name="flutterEmbedding"
android:value="2" />


</application>
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="http" />
</intent>
</queries>
</manifest>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.ccextractor.ultimate_alarm_clock

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent


class AlarmReceiver : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
if (context == null || intent == null) {
return
}


val flutterIntent = Intent(context, MainActivity::class.java).apply {
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK)

putExtra("initialRoute", "/")
putExtra("alarmRing", "true")
putExtra("isAlarm", "true")

}
val sharedPreferences =
context.getSharedPreferences("FlutterSharedPreferences", Context.MODE_PRIVATE)

val screenOnTimeInMillis = sharedPreferences.getLong("flutter.is_screen_on", 0L)
val screenOffTimeInMillis = sharedPreferences.getLong("flutter.is_screen_off", 0L)
val activityCheckIntent = Intent(context, ScreenMonitorService::class.java)
context.stopService(activityCheckIntent)
if (Math.abs(screenOnTimeInMillis - screenOffTimeInMillis) < 180000 || screenOnTimeInMillis - screenOffTimeInMillis == 0L) {
println("ANDROID STARTING APP")
context.startActivity(flutterIntent)
}
}
}
Loading