android-service

Can I use Android Camera in service without preview?

别来无恙 提交于 2019-11-30 10:14:16
I have create a application in Android that using a camera I can measure out the distance between user's face to the phone screen. Problem description: Now I want to make it running background so that the feature is available while I am using other applications. It means I should open camera in service without preview, and process it in service. What I did yet: I referred some questions here How to record video from background of application : Android How to use Android Camera in Background? Taking picture from camera without preview API level 16 My Service File import android.app.Service;

part-2 persistent foreGround android service that starts by UI, works at sleep mode too, also starts at phone restart

荒凉一梦 提交于 2019-11-30 10:10:17
Status: Really thankful to all who helped and guided here and in part-1! I have made code out of research and help given and have put that working code in EDIT-1 . Criticisms are welcomed to make the code better. Scenario: I asked the question mention in Part-1, but for some reason I can persistently cannot make a design and correct strategy with code that has true integration and sanity. It was a lengthy question and the question nor answer could have been concluded or finalized in just one episode, so I have made this second part as a synopsis. May be I am incompetent or just disturbed

Is it possible to have Android Voice Recognition (as a custom service) on Google Glass?

倾然丶 夕夏残阳落幕 提交于 2019-11-30 09:56:16
We have a demo android application (Android 4.0.3) that runs voice recognition as a service, and (continuosly) logs the results of the recognition on the view. Everything is working fine in our smartphones. We would like to replicate this scenario in a Google Glass immersion application, but we always have this error message when we try to start the service: no selected voice recognition service Are there some known limitations? Or have someone figured out how to resolve this kind of problem? Thanks in advance This is some significant code of the activity: public class MainActivity extends

AIDL interface can't find import for Parcelable class

一世执手 提交于 2019-11-30 08:53:11
问题 My issue seems to be similar to this question and this one but it is a bit different. I am making an AIDL service that is in a Library project and using it in my application. I have a class Vehicle that is in my application that I have made parcelable so that I can use it in my interface. (I would like to get a List of vehicles from my service that is in the library to my application) Do I need a Vehicle.java in both the application and the library? Do I need a Vehicle.aidl in both? I had

Prevent multiple copies of an Android service

蹲街弑〆低调 提交于 2019-11-30 08:17:58
The doco for startService states "If this service is not already running, it will be instantiated and started (creating a process for it if needed); if it is running then it remains running." I'm finding that each call to startService appears to be starting a separate instance of the service, in that the work that the service is doing (in my test case, trivially writing to a new log file) is being done again for each call. I'm trying to detect the service by looping through ActivityManager... getRunningServices(Integer.MAX_VALUE)) but it's not showing up. Android 2.3.3 on SGS 11 I'm missing

Android: Stop/start service created in onCreate()

二次信任 提交于 2019-11-30 08:08:52
问题 I currently have a service that is started within the onCreate method of an activity using: Intent intentService = new Intent(this, MainService.class); this.startService(intentService); I need to now be able to stop this service on a button press and restart it again on another button press, however I am unsure how to stop this service and start it again out side of the onCreate method. I guess I would need to start the service in a different way than what I am currently doing? But I am

How do I detect skype/telegram/whatsapp calls when my messenger app is in a call or wants to make a call?

南笙酒味 提交于 2019-11-30 07:34:32
问题 I am wondering if there is a way I can detect a skype call/telegram/whatsapp/fb messenger call etc in progress or incoming call etc just like the regular phone call with telephony manager/listener? I would like to have some kind of mechanism that detects an ongoing /incoming etc call from skype/telegram etc for my app. I came across this solution :Call Detection for skype in android but not sure if it'll work for all generic messenger apps. Is there a hack or any kind of listener I can

android service notify activity completed best way?

爷,独闯天下 提交于 2019-11-30 07:11:48
I created a service which syncs data from the web on a background thread and want to notify a list activity when the service has completed so it can update it's cursor? What would be the best way to do this? I'm thinking of sending a broadcast when the service is done but not sure if that's the best way to do it. I need to requery the cursor when the service has finished so I'm not sure if that will work well with broadcast receivers? I haven't done alot of android in awhile so thanks in advance. Use a Handler in your service that registers a client when your ListActivity connects to the

How can Android service update the UI of the activity that started it?

半世苍凉 提交于 2019-11-30 06:47:34
I'm new to Android programming, so I'm facing some general problems about choosing the best way to design my app. What I want to do is basically a media player. I want the media player to run on a service because I want it to play also when the activity is not displayed. My question is, how can I update the UI on my activity depending on the service working flow (for example, the song changes and I want its name to be displayed)? I guess I could use a Local Broadcast Manager in order to send intents from my service to my activity and invoke UI updates (does it seem right?) BUT... I will want

Persistent service

梦想的初衷 提交于 2019-11-30 06:34:14
问题 I know that some peoples view is that you should not create persistent services. But for those of us that want to increase our knowledge, how does one go about creating one in theory? I have been playing around, and noticed that services that use startForeground are killed in low memory situations. I have seen a, now deprecated, permission PERSISTENT_ACTIVITY , but that didn't do much. So what is the secret? 回答1: You can only make your service persistent if you are developing system apps.