background-service

Android application as a service without activity

梦想的初衷 提交于 2019-12-11 18:17:14
问题 I am making a set of apps and I have pretty much the same background service for all of them. I'm trying to make an app that has only this Service . so I don't repeat it in all of them, but the thing is don't need any Activity . because there is no UI needed for it, and so the user can't close it except if they stop the Service . I tried to remove the Activity , but then the app doesn't run or start. My question is: can I make an app exactly like Google Play Services so other apps can use its

Background Service stop after power saver enable and disable

被刻印的时光 ゝ 提交于 2019-12-11 02:15:43
问题 I have an application in which I perform some task in background, So the task will perform if my background service is running Problem : When I enable and disable power saver, so it close everything and stop every background services which are running. After turning off power saver the service is not getting start till I open the application. So how I can restart my background service when power saver off for lower version than Android.M Facing issue in Android 6.0 and below. Myservice.java

How to trigger a background service in android on specific time?

自作多情 提交于 2019-12-10 18:47:34
问题 I know how to trigger a background service in android even on specific time. I have used AlarmManager to achieve this, but I want to start that service daily on that time. Suppose I want to start it on 12pm, but the service should keep going on after that. I have also used the stopitself() method, but that does not work. Here is my code: void alram(Context ctx){ Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(System.currentTimeMillis()); cal.set(Calendar.HOUR_OF_DAY, 12); cal.set

Send application to back & bring to front

[亡魂溺海] 提交于 2019-12-10 17:17:38
问题 I want to develop an application where it will start on particular time & close on particular time. Similar like Alarm but not alarm application. As per my thinking I will start an service when application first started service will check current time & particular timing to match the condition & when condition is to close application it will simply send application to background so that service will be running & when condition for wake up occurs service will bring application front. Is this

Bluetooth Low Energy Android - Search in Background

限于喜欢 提交于 2019-12-10 10:47:54
问题 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? 回答1: 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

Press Power button Twice to send SMS

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 10:24:55
问题 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

How to restart Background service getting killed on redmi phone For MIUM 8

自作多情 提交于 2019-12-09 03:27:10
问题 I am using sticky service for background operations and its working fine in all phones even when app is closed by swiping from stack(then service is restart) but in RedMi Note 3w When app is closed by swiping from stack , service is not restarting .I test Whats App and its working fine on Note 3 so it means WhatsApp is able to manage this so how can we restart Background service getting killed on redmi phone? Note : please don't give me solution for MIUM 7 回答1: in MIUI 8 in setting

Async timer in Scheduler Background Service

时光毁灭记忆、已成空白 提交于 2019-12-08 09:36:59
问题 I'm writing a hosted service in .Net-Core which runs a job in the background based off of a timer. Currently I have to code running synchronously like so: public override Task StartAsync(CancellationToken cancellationToken) { this._logger.LogInformation("Timed Background Service is starting."); this._timer = new Timer(ExecuteTask, null, TimeSpan.Zero, TimeSpan.FromSeconds(30)); return Task.CompletedTask; } private void ExecuteTask(object state) { this._logger.LogInformation("Timed Background

How can my IntentService in background always listen to device's shake?

▼魔方 西西 提交于 2019-12-08 08:28:32
问题 I am developing an app which is basically one widget and one service. The widget is only a button which I want it to run the service in the device's background. So the user just clicks the button and nothing happens in the UI, the service starts in the background. But I want the background service, which I have implemented using IntentService, to ALWAYS listen to my device's shake in the background after the widget's button is clicked. It has to monitor the accelerometer sensor for any change

FusedLocationApi Background Location service stops receiving updates randomly

﹥>﹥吖頭↗ 提交于 2019-12-07 10:25:00
问题 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