alarmmanager

Service with AlarmManager running always every minute

半腔热情 提交于 2021-01-28 04:12:30
问题 I'm trying to set a service run every 5 minutes in background. But it's acting weird: At onCreate of Main activity, I'm scheduling it to run every 5 minute: public void scheduleAlarm(Context context) { Intent intent = new Intent(context, AdSyncStartReceiver.class); final PendingIntent pIntent = PendingIntent.getBroadcast(context, AdSyncStartReceiver.REQUEST_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT); long firstMillis = System.currentTimeMillis(); // alarm is set right away AlarmManager

Substitute for Alarm Manager - Android

a 夏天 提交于 2021-01-27 14:12:04
问题 Seriously, What is the solution to do a simple task like sending notifications when app is not running? (Using devices with custom OS like Xiaomi) When alarm is set, it works for short period of times like a few minutes, but not for long periods of time like hours. (although it works perfectly fine on some devices and also when the app is running) I have read hundreds of threads and no one has a concrete solution for this. None of the recommended methods work, I tried the following: Alarm

Android reschedule alarmmanager alarm when app is killed

为君一笑 提交于 2021-01-27 12:44:20
问题 I've developed an app to schedule multiple local notifications to remind users to do something. Every month in the current year there should an notification be raised. These local notifications are scheduled using an "AlarmManager". A notification is created and raised in the OnRetrieve of a "BroadcastReceiver". It works all fine until the app is terminated (by user) or the device is rebooted. After some research I found the solution to reschedule the alarm / local notifications if the device

Cannot do work in background periodically with alarmmanager

会有一股神秘感。 提交于 2021-01-27 10:39:50
问题 I want to call a service in background by the hour. first problem is alarm manager is not working smoothly. Timer is terrible, sometimes early sometimes later. second problem is, RemoteServiceException : Context.startForegroundService() did not then call Service.startForeground() , I cant understand why I get this exception MainActivity public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { Intent intent1 = new Intent(MainActivity

How to use Android AlarmManager in Fragment in Kotlin?

六月ゝ 毕业季﹏ 提交于 2021-01-12 06:30:21
问题 I can't seem to get the AlarmManager to work inside a Fragment. My receiver's onReceive() method never gets executed. I assume that I might use context in a wrong way but then again I also couldn't get it to work inside an Activity. I've also registered the receiver in my manifest. MyFragment.kt class MyFragment : Fragment() { ... override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) var alarmMgr: AlarmManager? = null lateinit var

How to use Android AlarmManager in Fragment in Kotlin?

非 Y 不嫁゛ 提交于 2021-01-12 06:29:15
问题 I can't seem to get the AlarmManager to work inside a Fragment. My receiver's onReceive() method never gets executed. I assume that I might use context in a wrong way but then again I also couldn't get it to work inside an Activity. I've also registered the receiver in my manifest. MyFragment.kt class MyFragment : Fragment() { ... override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) var alarmMgr: AlarmManager? = null lateinit var

How to use Android AlarmManager in Fragment in Kotlin?

时光毁灭记忆、已成空白 提交于 2021-01-12 06:27:08
问题 I can't seem to get the AlarmManager to work inside a Fragment. My receiver's onReceive() method never gets executed. I assume that I might use context in a wrong way but then again I also couldn't get it to work inside an Activity. I've also registered the receiver in my manifest. MyFragment.kt class MyFragment : Fragment() { ... override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) var alarmMgr: AlarmManager? = null lateinit var

How to schedule an alarm on specific time in Flutter?

拜拜、爱过 提交于 2021-01-05 06:18:04
问题 In my Flutter project, I want to schedule an alarm on a specific time of a day or just trigger the built in alarm in my phone on that particular time. For that purpose, I have integrated one plugin from Flutter - https://pub.dev/packages/android_alarm_manager#-example-tab- And then I followed exactly the example given in that documentation and added all the permissions in Android Manifest file. After running this project it shows like below- It is showing one button to shot one alarm but it