broadcastreceiver

sending data from activity to Intentservice

☆樱花仙子☆ 提交于 2021-01-27 13:26:56
问题 my needs is to send data from activity to IntentService (from class that extends activity, to class that extends IntentService) i successed to send to sample service, by using BroadcastReciver, but i want to extend IntentService class and not service someone know how can i do that? from public class MainActivity extends Activity { ... } to public class MyIntentService extends IntentService { ... } 回答1: Put the data in an Intent extra that you use with the startService() call to start your

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

Getting the user's location in Android when the phone is locked

泪湿孤枕 提交于 2021-01-23 01:55:21
问题 I am looking for a solution to get the user's location in a specific time-interval in Android API 17 (Android 4.2) and when the phone is locked. I've already tried some different code, checked a lot tutorials and searched almost everywhere on the web. The solution might be there, but I think it's a combination of lack of experience with Android developing and interpreting the different right solutions and approaches. At first I had some pretty basic code, which worked very well when the

Getting the user's location in Android when the phone is locked

眉间皱痕 提交于 2021-01-23 01:54:16
问题 I am looking for a solution to get the user's location in a specific time-interval in Android API 17 (Android 4.2) and when the phone is locked. I've already tried some different code, checked a lot tutorials and searched almost everywhere on the web. The solution might be there, but I think it's a combination of lack of experience with Android developing and interpreting the different right solutions and approaches. At first I had some pretty basic code, which worked very well when the

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 do you use receiver (BroadcastReceiver) in a flutter plugin?

爷,独闯天下 提交于 2021-01-01 06:55:46
问题 Problem I am building an application that requires some of the functionality of the Radar.io SDK, and so I decided to create plugin so after this project is over I can share the plugin with the rest of the Flutter Community. The problem is, I am not able to receive events in this plugin. This is important for the plugin since in order to receive events such as geolocation triggers and other background events this receiver needs to be receiving realtime information. I have successfully