android-service

Hotword detection disabled with accessibly service

两盒软妹~` 提交于 2019-12-02 09:12:37
问题 I've created a accessibly service for saving every toast message, but now hotword detection in Google Now will be disabled, if I activate my service. Logcat shows: W/HotwordState﹕ suspended: 11001001000000 And on Google Now you can see it with a different mic-icon. What could cause this behavior? Edit: The source code is on github now: https://github.com/mars3142/toaster 回答1: To prevent false positives, hotword detection is disabled when a spoken feedback service is enabled. You have defined

take photo from camera in service

谁说我不能喝 提交于 2019-12-02 08:59:39
How can Take picture from front camera in service without showing camera on screen. I have service class public class PhotoTakingService extends Service { //Camera variables //a surface holder private SurfaceHolder sHolder; //a variable to control the camera private Camera mCamera; //the camera parameters private Parameters parameters; boolean mPreviewRunning = false; /** * Called when the activity is first created. */ @Override public void onCreate() { super.onCreate(); } @Override public void onStart(Intent intent,int startId) { // TODO Auto-generated method stub super.onStart(intent,startId

Get screenshot of current foreground app on Android having root priviliges

江枫思渺然 提交于 2019-12-02 08:43:58
I'm developing an application that is installed on the system partition and I would like to know if it's possible to get a screenshot of the current foreground application from a service. Of course, the application being any third party app. I'm not interested in security issues or anything related to that matter. I only want to get a snapshot of the current foreground third party app. Note: I'm aware of the /system/bin/screencap solution but I'm looking for a more elegant alternative that does everything programmatically. The method that I'm going to describe below will let you to

Couldn't get user location

三世轮回 提交于 2019-12-02 08:22:38
I am trying to get user location either network location or gps location or both. for that i am running a background service which implements LocationListener . i added all the require permissions in the manifest file also. here is my service public class GetLocation extends Service implements LocationListener { LocationManager lm; Location networkLocation, gpsLocation; @Override public void onCreate() { super.onCreate(); lm = (LocationManager) getSystemService(LOCATION_SERVICE); if (lm.isProviderEnabled(LocationManager.GPS_PROVIDER)) { lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0

How to check new android 6.0 Permissions from service

安稳与你 提交于 2019-12-02 08:01:10
I've an Android 6.0 Application with an unbound android service connecting to Google API for receiving Fused API Location Provider Updates. For this i need the ACCESS_FINE_LOCATION Permission. Everthing was working fine untill the Update to Marshmallow. Now I need to implement the new Permission Model for my App. I've read that it is not possible to check android 6.0 Permissions directly from within a service. All of my Location Update Receiver and Google APi Client connect part is handled by and in the service, and I would linke to keep it there! Is it possible to check the Permissions once

Access the results of a started service from two different activities in Android

心已入冬 提交于 2019-12-02 07:49:21
问题 I have a service that gets the user's location and broadcasts the latitude and longitude in an intent. I believe that I need the service to be a started service (as opposed to bound service), because I would like for it to be able to send a push notification to the user when a new geoFire entry from firebase enters their radius even when the app is closed. Currently, the service is set up to broadcast the location. Given that the location service will be a started service, I don't know how to

calling getSystemService inside a service

天大地大妈咪最大 提交于 2019-12-02 07:38:51
I'm trying to write a service that get the heart rate on Gear Live, following the question here Get Heart Rate from "Sensor" Samsung Gear Live If I put this part Log.d(TAG, "prepare to call getSystemService"); mSensorManager = ((SensorManager)getSystemService(SENSOR_SERVICE)); Log.d(TAG, "after calling getSystemService"); at onCreate() of an activity, it works fine. But if I move that to a Service, it throws a NPE. I tried to add this. in front of `getSystemService, doesn't help. Any tip, thanks I figured it out, the reason is that inside getSystemService , there's a call to this function:

How to list all services in an android device

做~自己de王妃 提交于 2019-12-02 07:13:42
问题 I am looking for a reliable way to programmatically find and list all available services in an Android device (both running and not running). The closest thing I could find in the API is getRunningServices() on ActivityManager but even that is marked boldly: Note: this method is only intended for debugging or implementing service management type user interfaces. and it lists only running services anyway. Is there a reliable way to find all available services in a given Android device?

Cant stop Firebase JobDispatcher service

有些话、适合烂在心里 提交于 2019-12-02 06:46:01
问题 Possible Duplicate I have created a JobDispatcher service to keep getting user location in background and post user location to server. For that i have created a Job as follow: private void startLocationJobService() { // Check if location job service already running if(!isMyServiceRunning(LocationJobService.class)) { Context context = config.getActivity(); FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(context)); Job job = dispatcher.newJobBuilder()

How to add custom InputMethodService to Activity?

我是研究僧i 提交于 2019-12-02 06:09:45
问题 I decided to create a custom keyboard for my application. I know that this is not the best idea, since it's hurting the user friendliness, that's why I will just make it optional in Preferences. After having it all done in a class public class CustomKeyboard extends InputMethodService implements KeyboardView.OnKeyboardActionListener . I struggle to add it as a softInputMethod . I tried with the InputMethodManager but I get incompatible types when casting it. I found that I can get it w/o the