android-service

How can I display a code drawn line over other apps?

不羁岁月 提交于 2020-01-02 09:28:12
问题 Details: I would like to add a code drawn line (like you draw with canvas/paint) and display it over other applications. I currently have an application that allows me to display an image over other application. See my Stackoverflow answer for my code. I have implemented the permission to do so: android.permission.SYSTEM_ALERT_WINDOW I have tried to add a canvas/paint to the WindowManager without errors, but my app crashed. I have tried searching for an answer, but have turned up empty. If

How can I display a code drawn line over other apps?

萝らか妹 提交于 2020-01-02 09:28:05
问题 Details: I would like to add a code drawn line (like you draw with canvas/paint) and display it over other applications. I currently have an application that allows me to display an image over other application. See my Stackoverflow answer for my code. I have implemented the permission to do so: android.permission.SYSTEM_ALERT_WINDOW I have tried to add a canvas/paint to the WindowManager without errors, but my app crashed. I have tried searching for an answer, but have turned up empty. If

Unable to implement callback in Android

微笑、不失礼 提交于 2020-01-02 07:49:07
问题 I am building an SDK. The Scenario From the app, the developer passes the JsonObject and URL in a method and inside the SDK. I add those values in SQLite database and start a JobScheduler. The Jobscheduler takes the request at 0 indexes out of the database executes it. When I get the response, I delete that request from the database and now the request at 1 index comes to the 0 index and again I execute the same code where 0th index request is fired. The Problem When I get the response from a

How to debug remote AIDL service in Android?

点点圈 提交于 2020-01-02 07:13:12
问题 I have sources of a remote service which is using AIDL. Also I have my own app that connects to that service. I debug two apps simultaneously, but inside the remote service I can hit breakpoints only in generated AIDL file (stub and proxy), but I can't hit the real methods of the remote service. What can be the reason? Maybe I'm doing something wrong? Thanks! 回答1: It's a while since I tried this, but from memory I think what I did was : I set the breakpoints in the source, started the app

NullPointerException in Service's constructor

廉价感情. 提交于 2020-01-02 06:39:14
问题 In my Android project, I have a Service : public class MyService extends Service{ //I defined a explicite contructor public MyService(){ //NullPointerException here, why? File dir = getDir("my_dir", Context.MODE_PRIVATE); } @Override public void onCreate(){ super.onCreate(); ... } @Override public int onStartCommand(Intent intent, int flags, int startId) { super.onStartCommand(intent, flags, startId); ... } } I know normally, I shouldn't explicitly define a constructor for Android Service .

Android Service - startService is called multiple times and causes value mixup…

泪湿孤枕 提交于 2020-01-02 04:01:08
问题 I have some conditional calls from my code which starts same service with different data values passed through bundle to that service. When I checked for only one condition met, service works fine for all conditions. But when 2 or more conditions match, these calls this same service but with different data values in bundle. Problem is when this scenario is met the values sent by first call are not getting replaced for second condition to start same service. So service is responding wrongly.

NotificationManager.cancel() doesn't work: Notification isn't removed

本秂侑毒 提交于 2020-01-02 02:51:28
问题 I've been trying to remove a persistent Notification set by a Service using: startForeground(1337, notification); The code I'm using to cancel it: NotificationManager nManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); nManager.cancel(1337); // cancel existing service notification, doesn't take effect nManager.cancelAll(); //surpluous, but also doesn't take effect To clarify why I am doing this: the Service starts with a default persistent Notification.

IntentService's onHandleIntent(Intent) gets null argument

房东的猫 提交于 2020-01-01 23:14:26
问题 I'm using an IntentService to run a background service for my app on android. Oddly I'm getting a lot of crash reports with cases where the intent passed to onHandleIntent is null. I'm not even sure how this is possible and seems extremely odd. Can anyone suggest why this might be happening? STACK_TRACE java.lang.NullPointerException at com.example.MyService.onHandleIntent(MyService.java:466) at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) at android.os

Android: how to save sensor data continuously while app is doing other works

半腔热情 提交于 2020-01-01 20:00:10
问题 im new to android. i'm deveping an app to continuously save sensor's data and beside that takes photos. in fact i want to start saving accelerometer data in to a file while taking photos, or while screen is blacked out. i have reached to this point that my app saves sensor data as i touch a button, but it does it once. how can i make it to saves data continuously and without affecting other parts of my app to run? and i want it saves data while i'm taking photos in my app, when screen is

How to access instance of MediaBrowserServiceCompat service?

岁酱吖の 提交于 2020-01-01 19:42:33
问题 I'm surprisingly struggling to get hold of the instance of a service which is derived from MediaBrowserServiceCompat . For a typical service, to achieve that, a local binder is used class MyService extends MediaBrowserServiceCompat { class MyBinder extends Binder { public MyService getService() { return MyService.this; } private final MyBinder binder = new MyBinder(); @Override public IBinder onBind(Intent intent) { return binder; } public void doMagic() { // <-- How to call this from