This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:tools="http://schemas.android.com/tools" | |
| package="com.escodro.alkaa"> | |
| <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" /> | |
| <application/> | |
| </manifest> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val alarmManager: AlarmManager = getSystemService(Context.ALARM_SERVICE) as AlarmManager | |
| val hasPermission: Boolean = alarmManager.canScheduleExactAlarms() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val intent = Intent().apply { | |
| action = Settings.ACTION_REQUEST_SCHEDULE_EXACT_ALARM | |
| } | |
| startActivity(intent) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| internal class MyBroadcastReceiver : BroadcastReceiver() { | |
| override fun onReceive(context: Context, intent: Intent) { | |
| when (intent.action) { | |
| AlarmManager.ACTION_SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGED -> { | |
| // redefinir todos os alarmes | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
| package="com.escodro.alarm"> | |
| <application> | |
| <receiver | |
| android:name=".TaskReceiver" | |
| android:exported="false"> | |
| <intent-filter> | |
| <action android:name="android.app.action.SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGED" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| internal class MyBroadcastReceiver : BroadcastReceiver() { | |
| override fun onReceive(context: Context, intent: Intent) { | |
| when (intent.action) { | |
| AlarmManager.ACTION_SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGED -> { | |
| // reschedule all the exact alarms | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val dynamicColor = isDynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S | |
| val colorScheme = when { | |
| dynamicColor && isDarkTheme -> dynamicDarkColorScheme(LocalContext.current) | |
| dynamicColor && !isDarkTheme -> dynamicLightColorScheme(LocalContext.current) | |
| isDarkTheme -> MyAppDarkColorScheme | |
| else -> MyAppLightColorScheme | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class HelloWorldWidget: GlanceAppWidget() { | |
| @Composable | |
| override fun Content() { | |
| Text(text = "Hello world!") | |
| } | |
| } | |
| class HelloWorldWidgetReceiver : GlanceAppWidgetReceiver() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Button( | |
| text = "Home", | |
| modifier = GlanceModifier.clickable(actionStartActivity<HomeActivity>()) | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Button( | |
| text = "Update", | |
| modifier = GlanceModifier.clickable(actionRunCallback<UpdateAction>()) | |
| ) | |
| class UpdateAction : ActionCallback { | |
| override suspend fun onRun(context: Context, glanceId: GlanceId, parameters: ActionParameters) { | |
| // Update! | |
| } | |
| } |