Questions tagged [android-service]
2280 questions
0
votes
0
answer
6
Views
How access pictures after they have been taken by camera used by other app
I have an idea for an android service, and I need to be able to access pictures before they're being taken, to save GPSlocation, moreover, I need also an access to the picture immediately afterwards.
Is there any proper way to do it ?
0
votes
0
answer
5
Views
Android - onHandleIntent of IntentService is never called
My android application declares in AndroidManifest.xml a service responsible for displaying error messages for the whole system.
In the application class is declared a global exception handler.
public class DetectxApp extends Application {
@Override
public void onCreate () {
super.onCreate();
Threa...
0
votes
1
answer
11
Views
Action during onMessageReceived() in FirebaseMessagingService
I want to do something everytime onMessageReceived() triggers specifically. I want to send text messages. I'm not really sure if it's a great idea to put a code in FirebaseMessagingService that runs a task that might take a little while to finish (number of messages sent may vary). Do you guys have...
1
votes
1
answer
254
Views
How can we access data in service passed from activity using bundle ?
In Activity:
Intent service = new Intent(OverlayShowingService.this, shortLayer.class);
service.putExtra('prevact','overlayService');
startService(service);
stopService(service);
What is Bind service? Were can I access my data from activity ? What did I made a miskake?
In service:
@Override
public I...
1
votes
1
answer
451
Views
onHandleWork never receives intent from pending intent Geofencing
I am working on a Geofencing application. The JobIntentService subclass that handles the GeofenceTransitions never receives the intent. I am receiving location updates at one minute interval then creating a new geofence list then adding the geofences based on a user's current location.
Here's my And...
1
votes
0
answer
722
Views
android add_service([email protected]) fails- /dev/vndbinder permission denied
I'm working on HiKey aosp installed running on Linux 16.04, trying to connect v4l2 camera and use it. Currently, I've added the device drivers for v4l2 and usbcamera, and added the camera-hal to ~/(aosp)/device/linaro/hikey/camera directory. media_profiles.xml is contained in this directory.
I'm fac...
1
votes
2
answer
263
Views
android - Background service
I am writing android application which will request the data from the server after every 5 minutes and will load it into the sqlite. Later on, the data from the sqlite will be displayed to the user whenever he wants to view the data. Database will contain only the data up to last 2 days and will kee...
1
votes
0
answer
232
Views
How to change the bluetooth headset button click functionality?
I have made a broadcast receiver with the below code.
public class MediaButtonsIntentReceiver extends BroadcastReceiver {
public MediaButtonsIntentReceiver() {
super();
}
@Override
public void onReceive(Context context, Intent intent) {
String intentAction= intent.getAction();
if(!Intent.ACTION_MEDI...
1
votes
1
answer
327
Views
“foreground” service is killed when App is removed from recent apps
I have an App with a foreground service (which calls startForeground) which shows a notification. The notification is set to ongoing and updated by the service every second.
The service works perfectly fine in most devices, expect some of the devices from MI or Oppo. In those devices the service get...
1
votes
3
answer
767
Views
Notification started from service doesn't open the app on click
Good Morning,
I've made an application that implements GpS Location. I have a service that save my location on LocationChanged event. To avoid that Android close my app I start a notification and all works well. But now, I want that when I click on notification from Action Bar the app come back in f...
1
votes
0
answer
465
Views
How to keep JobIntentService running on Oreo?
I have two services. One of handles receiving call states.
Other handles an overlay window.
My problem is I can't keep services running. I could refactor receiving call states service. It gets each states changes and runs like new jobs. But other one which shows overlay, I can't do the same. I nee...
1
votes
0
answer
429
Views
Firebase cloud messaging service not running on Oreo
I am working on a chat app for which i am using Firebase cloud messaging.
Everything works fine till android nougat , But as i have explored Android Oreo doesn't support background services . That's why my firebase push notification service is not running when app is stopped .
onMessageReceived() is...
1
votes
0
answer
476
Views
How to keep Content provider running for external app
I have a 'data hub' that contains a ContentProvider that I wish to access from other external apps. I have so far succeeded in setting up the required permissions and contract classes to access the data through a ContentResolver, which works well enough as long as the data hub app is still running....
1
votes
0
answer
10
Views
Case when intent is null with 'START_REDELIVER_INTENT' is possible?
In an extended class from Service class when we use the onStartCommand method with the return value 'START_REDELIVER_INTENT', the method will be called with the last intent that was delivered to the service.
Is there a case when the service returns to the method returns Intent equal to null, taking...
1
votes
1
answer
239
Views
Android Oreo time sensitive background work
When migrating my app that needs to do time sensitive background work to Oreo i encountered a problem following the Migration Guide:
Pre Oreo I used a Service started by Alarmmanager.setAndAllowWhileIdle to shedule my work to always run within a few minutes of the sheduled time. Now, with Oreo, I am...
1
votes
2
answer
100
Views
Is there any way to implement scheduled task on < 21 API?
I am newbie with android and I want to perform task only on some conditions.
I have read about Job Scheduler and see the tutorial by the Vogella.In that the mention Job Scheduler introduced in API 21. I have searched for what are the similar options that can be used for API < 21 and found the gcmNet...
1
votes
0
answer
411
Views
Keep SignalR connected in background in Android Oreo
I used a service in my android app that check SignalR connection state every 10 seconds and if was disconnected, try to init SignalR and make it connected.
But in Android 8 some limitation added (Read more), that kill background services and also we can't call startService method to start service fr...
1
votes
0
answer
63
Views
How to access singleton class from service when the app is not running
I have created a singleton class User, and I am setting some values in the class from activities. I am using those values for the service (which I am calling from Broadcast receiver). When the app is running, the service gets the values from the User claa. But, when the app is not running, the servi...
1
votes
0
answer
30
Views
service data reset after swiping away application
Purpose of program: I'm trying to make an app that will count how many times the user checked their phone by issuing a broadcast for Intent.ACTION_SCREEN_ON. it then increments a counter and updates the activity with the new counter.
The problem: This all works just fine but as soon as I swipe away...
1
votes
1
answer
102
Views
Is there any callbacks which help to detect when application gets killed (swipe, app crashed)?
Unlike Activity, which has a clear lifecycle (onCreate ... onDestroy), Application only has onCreate method. I want to handle some events when the app gets destroyed, but yet find any solution for this. I have read some topic related to this issue, they suggested me to use Service. Does anybody have...
1
votes
0
answer
278
Views
My Job not listed in pending job : android JobScheduler
Scenario
Hi,
I have a JobService that I launch when I come to my HomeScreen. This job service takes my requests out from my DB and execute them whenever internet is available. So even if the device is offline, I insert my transactions in my DB and whenver internet comes, my JobService executes those...
1
votes
0
answer
38
Views
Retrieving the package name of the app which binds to my service
I have an android Service in my app which external apps can bind to. Also, when an app binds to my service I return a Messenger for them to use for communicating with my service. This is kinda what it looks like
public class MyService extends Service {
private Messenger mMessenger = new Messenger(ne...
1
votes
1
answer
24
Views
I want the instance of the Background service which is running
In this, the service is been create repeated times but I need to get the instance of running service so that I can start the timer task. The object of this service can get from any activity. The basic aim is to start the timer task after the particular button click.
public class MainActivity extends...
1
votes
0
answer
32
Views
Receive location updates even when phone is locked?
I have been trying to receive location updates when my phone is locked I am using a service that is launched by my main activity. I receive location updates when the application is open just fine but when locking the phone the service continues to run but the location stored is the same every time....
1
votes
1
answer
59
Views
Use of global variable in never ending service
I created a never ending service but I'm not sure that it's OK to do what I did with this service. I declared global variable like static String list_contact
and fill the list from a db in onCreate method. I wanted to avoid to retrieve data from database each time because I need to compare to the li...
1
votes
1
answer
574
Views
Android service background Android Oreo
in my Android project i've created an custom clock widget with a service which contains an instance of Broadcast Reciever and an intent filter. The Broadcast Reciever provides the update of the widget every time arrives the ACTION_TIME_TICK. This is working perfectly when set targetSdkVersion to 25,...
1
votes
1
answer
44
Views
Send data(Client_id=1,Staff_id=2) from android application to tomcat server
i want to send data from android application to tomcat java server.
Data is just one is client_id which is 1 and second is staff_id which is 2.
after authenticate the client id and staff id from tomcat show me a toast of success....please help...
Code is here
public class MyAsyncTasks extends Async...
1
votes
0
answer
157
Views
How to call service methods in a widget?
I have created service called BluetoothService class. In this method, I have created a method to send data to a connected Bluetooth device.
I have developed a widget home screen, it has few buttons when the user clicks this buttons I want to send data to the Bluetooth device. Android doesn't allow b...
1
votes
1
answer
64
Views
startService() causing UI Thread to Freeze
In my app I am starting a foreground service and showing a progress dialog to update the user on progress. On certain phones starting the foreground service causes the ui to lag for a few seconds. If I disable the following code, the ui responds fine.
The code to start the service is applicationCont...
1
votes
0
answer
242
Views
How I can make request OkHttp in Service use Thread?
I have trouble creating Thread in a Service and in Thread I use OkHttp. When running the app I get an error
E/AndroidRuntime: FATAL EXCEPTION: Thread-468
java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
I created a service and service that created m...
1
votes
1
answer
490
Views
Firebase Job Dispatcher Not Scheduling
I looked at several answers for this but am not getting anywhere. Does anyone know why my FirebaseDispatcher is not executing? I set a trigger window between 1 and 5 seconds just to see if it works.
My application launches and this method is called upon from a utility class:
private static void sch...
1
votes
1
answer
44
Views
Android: is it possible/advised to interact with a Bound Service from Adapter?
I have some complex data modeled by a data class, with both immutable and mutable fields:
data class book (
val ISBN: String,
val Author: String,
...
var borrowed: Boolean
)
And I'm trying to find a way to display a number of instances of it in a RecyclerView.
I reckon the Adapter's only concern is...
1
votes
0
answer
55
Views
onSkipToNext using MediaControllerCompat in MediaBrowserServiceCompat (Service Class)
I'm skipping to next song using following code line in my activity's media player. Below solution works for such situation.
MediaControllerCompat.getMediaController((MainActivity) context).getTransportControls().skipToNext();
However the problem I have right now is, I'm implementing a notification p...
1
votes
1
answer
75
Views
Update UI at onResume using LocalBroadcastManager
I have a Service that frequently updates the Main Activity UI by passing values via a LocalBroadCastManager. The following method is triggered within the Service to pass the value to the Main Activity:
private void updateUI(String statusValue){
broadcastIntent.putExtra('status', statusValue);
LocalB...
1
votes
1
answer
24
Views
Can't stop BluetoothAdapter started from background service
I have a service which is running in background process.This service is going to search for bluetooth devices after the application is killed by user.
in BLEBacgroundService class I have:
public class BLEBackgroundService extends Service{
.
.
.
public BLEDetector bleDetector;
public int onStartComma...
1
votes
0
answer
47
Views
Background service doesn't work at boot device start
I'm trying to create a background service, this service have to start when device boot start, so atm I have:
AndroidManifest.xml
my BroadcastReceiver:
public class Startup extends BroadcastReceiver {
private static final String TAG_BOOT_BROADCAST_RECEIVER = 'TEST';
@Override
public void onReceive(C...
1
votes
0
answer
43
Views
Android - Cancel notifications from other apps
I am trying to make a launcher which automatically cancels the notifications of some specific apps (whose package name is stored in variable label) registered in the SQLite database.
I have retrieved data from database in the NotificationListenerService onCreate() Method and cancelled the notificat...
1
votes
0
answer
33
Views
Reasons why a service could be stopped in android
If I have an app that does not have any activities, just one BOOT_COMPLETED broadcast receiver and the simplest service. The receiver will just start the service and the service will just ran the following code:
public class ScreenStateService extends Service {
@Override
public IBinder onBind(Intent...
1
votes
2
answer
68
Views
Service stops when I exit my app
I have an application with a service. Service is started by an app in the main activity on create method. My problem occurs when I exit from the application: service stops
Manifest File
I don't know how to initiate my service when an app exit
Service
public class CallDetectService extends Service {...
1
votes
0
answer
47
Views
Obtaining Access Token Using ADAL in an Android Service
I am developing a Xamarin Android app and I have an Android service that needs to obtain an access token using ADAL. I am able to obtain a token in an Android activity following the sample code here. However, in an Android service, OnActivityResult is not defined, which means I need a new way to con...