background-service

Bluetooth Low Energy Android - Search in Background

二次信任 提交于 2019-12-06 08:33:36
I would like to know whether it is possible to check in the background if someone enters or leaves the a beacon Region? In iOS for example you can use the methods didEnterRegion or didExitRegion to send notifications from the background. Is there any native possibility or has someone a workaround? Android doesn't have any "native" iBeacon capability at all, but you can see iBeacons using my company's open source Android iBeacon Library , which has APIs similar to those native to iOS 7. In the case of iOS, the CLLocationManagerDelegate gives you access to the didEnterRegion and didExitRegion

Press Power button Twice to send SMS

拟墨画扇 提交于 2019-12-05 18:36:42
I have written an app in which the user can send messages whenever they press a button given in the activity, and it works fine for me, but now my target is to send SMS by using double press on power button . but I don't have any idea, how to do that ? Send SMS by using double press on power button below is the code, which I am using to send SMS: btnPanic.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub String message = "My current location is:" + "\t" + currentLocation ; String phoneNo = editContacts.getText().toString();

FusedLocationApi Background Location service stops receiving updates randomly

烈酒焚心 提交于 2019-12-05 15:36:25
i'm trying to use FusedLocationApi with pending intent to get period location updates so i can send the data to some server for processing. Everything works. However, there are some instances where the broadcast just stops receiving. I would need to restart the service again in order for it to continue. I already have the service onStartCommand to return START_STICKY so even if the app is killed it should start the service again. Furthermore, I also added a Boot Completed Intent Receiver so if the phone died and user restarted phone it would restart my service. So it seems everything is fine

Keep background service running after killing an application

£可爱£侵袭症+ 提交于 2019-12-04 21:06:12
I have developed an android application which runs background service, I need the service to stay alive even if the application is killed by user or for some reason. I have implemented the service and add return START_STICKY in onStartCommand method like this: public int onStartCommand(Intent intent, int flags, int startId) { super.onStartCommand(intent, flags, startId); Log.d("my_state","On start command"); return START_STICKY; } also I defined the service in AndroidManifest.xml like this: <service android:name=".MeterDistanceCalcService" android:exported="true" android:enabled="true" android

Timer Task stops running after indefinite time in android

怎甘沉沦 提交于 2019-12-04 10:12:40
I am a newbie in android. I am developing an app in which a particular piece of code executes after every 5 seconds in background.To achieve this I am using a service with timer with a timer task in it. For sometime its working fine but after some indefinite my service is running but timer task stops automatically in android. Here is my code please help. Thanks in advance. public void onStart(Intent intent, int startid) { //this is the code for my onStart in service class int delay = 1000; // delay for 1 sec. final int period = 5000; // repeat 5 sec. timer = new Timer(); timer.schedule(new

Android Bluetooth background listener

 ̄綄美尐妖づ 提交于 2019-12-04 10:02:50
问题 I am developing an android application with bluetooth chat. I have successfully implemented bluetooth chat with two phones.But my problem is that if I Change to next activity from the chatting activity the connection is lost then I am not able to send messages from second activity. How can I maintain my connection? That is I want to stay connected through out my app. Whenever the user press on exit button then only the connection can disconnect. I want to send message from one activity and

Background service to control proximity sensor

拥有回忆 提交于 2019-12-03 22:40:59
问题 I need to run a service (always in background, I want the service constantly checking even if the application is closed) that control the proximity sensor status, and when it's covered launch an activity. I tried but I had error. Any examples of something like this? P.S. In my AndroidManifest I added: <service android:name="xxx.xxxxx.xxxxx.MyService" android:enabled="true" /> Here my MyService.java: (Eclipse don't report any error but when I try it on my device, apps give a force close.)

How to use Android AlarmManager with small intervals like 1 minute?

喜欢而已 提交于 2019-12-03 18:05:26
问题 I want to make some external service monitor and be notified on problems as fast as possible. I tried to set up AlarmManager with 1-2 minutes interval, but it looks like it fires randomly every several minutes. Of course, I want to be safe from killing my background task by android, which would stop monitoring if I just use Service . Is it possible to use AlarmManager in small, accurate intervals? Which approaches are used in applications like Facebook, Gmail to notify about new messages?

Get LocationUpdates in background service continuously

旧巷老猫 提交于 2019-12-03 13:42:57
问题 I am working on application which requires to fetch location updates continuously in background service. I have used background sticky service with which it is working. But service is not starting after boot complete even though I have added boot broadcast and have started the service there. Service starts and immediately gets killed. Also, this is not working on Oreo. Service stops after few minutes of application gets closed and never restarts till app is relaunched. I have gone through lot

Is there any equivalent of Services of Android in iOS?

烈酒焚心 提交于 2019-12-03 11:25:19
I want to check the database in my app every 12 hrs for rows with date column having corresponding date. This is accomplished by writing service in android. But is there any equivalent of services in iOS so that my requirement can be accomplished? Segev No. There is no such thing in the SDK or in iPhone/iPad in general. You can only write code that will affect the eco system of the app, not the operating system. When your app is closed it's closed and no action will be taken until the user opens it/opens a push notification related to your app. If the user approved location based services for