android-service

Building an Android APK with same certificate as the system

僤鯓⒐⒋嵵緔 提交于 2019-12-01 01:54:26
I'm trying to make a system app work. Here's what I have: An OEM OMAP platform with full 4.4.2 source code. I've built the system and loaded on my platform using Ubuntu 14.04. That all works. Now, there is an app from the OEM which directly accesses the hardware (DSP, I2C, UART) etc. The original APK that came from the OEM works on my platform. I built the exact same app using make command (not using Eclipse); It builds and I can install on the platform. But when I try to launch the app, it gets stuck in an eternal wait state. I am not sure, but I suspect my locally built app tries to

“Cannot perform this action on a not sealed instance” java.lang.IllegalStateException exception

倖福魔咒の 提交于 2019-12-01 01:41:47
问题 With android AccessibilityService able to paste in other app EditText Field, but with browser testfields (Emulator Default Browser or Samsung deault Browser) its not working, throwing error: Cannot perform this action on a not sealed instance. In android chrome browser with some singnup textfield its working but not for all textfields. @Override public void onAccessibilityEvent(AccessibilityEvent event) { AccessibilityNodeInfo source = event.getSource(); if (source != null && ( event

Android Local Service Sample, bindservice(), and ServiceConnection()

痴心易碎 提交于 2019-11-30 23:18:02
I have a question which is related to this question that was asked by @mnish about a year ago. Please have a look at his question and code. He implements a ServiceConnection() and passes it to bindService(). This follows the Local Service Sample in the Service documentation near the top. I want to implement the Local Service Sample, so I am trying to add some details from @mnish question/answer. In ServiceConnection() @mnish has this line that confuses me: mService = ILocService.Stub.asInterface(iservice); I understand @mnish wrote this code, but does anybody have any idea what ILocService is

Android download queue using DownloadManger

倾然丶 夕夏残阳落幕 提交于 2019-11-30 23:17:55
I'm using DownloadManager to download my files in android and its great since it handles everything (connectivity lost, retry, etc.) The problem is I want my file to be downloaded in queue one after another and as far as i know DownloadManager doesn't provide this functionality. So multiple call to DownloadManager.enqueue(...) results in concurrent download of all the files. How can i fix this? I can not just make a queue in my activity and send downloads to DownloadManger one by one since activity may be destroyed at any time! Also IntentService doesn't work here!! even though it handles

Start a service from Thread.UncaughtExceptionHandler?

爱⌒轻易说出口 提交于 2019-11-30 22:41:13
I'm trying to setup a global exception handling service as mentioned in this answer . This approach sounds logical because after a crash, the code in my custom Thread.UncaughtExceptionHandler may not execute successfully, either because the application may not be in a stable state or because there may not be enough time before the process is killed by the OS. Unfortunately, this approach doesn't seem to work because the service launches in the same process so it, too, is killed. How can I start a service from the handler's uncaughtException() ? Can I force the service to launch in a completely

Using an AsyncTask inside a Service Class?

别来无恙 提交于 2019-11-30 22:31:26
I have to upload data to a server. I am using a service that is running on the same process as my application. Should I use a Separate thread for upload process or Should I use a AsyncTask to upload data to server ? More specifically can I use AsyncTask inside a service class ? And should I use it ? This service should always be running in memory in order to send data to the server every 5 seconds. user666 Yes you can, the below code will run every 5 seconds. Use your regular connection code for sending part. public class AsyncTaskInServiceService extends Service { public

Not getting the updated value of the shared preference in the service

天涯浪子 提交于 2019-11-30 22:04:46
I am storing some value to a shared preference from an activity which launched from a widget. If I retrieve that value from the service started from the same widget, it is not the updated one. I am getting the previous value had in the shared preference. Even i check that value in the shared preference xml, i sees the updated one there. Why this is happening. I know that widget and activity are two process, is that the reason?​ SharedPreferences preferences = getSharedPreferences("preferences_target_value", Context.MODE_PRIVATE); String targetValue = preferences.getString("preferences_target

Android keep BroadcastReceiver in background

南楼画角 提交于 2019-11-30 22:00:17
I created a BroadcastReceiver and it runs only when my app shown in recent apps menu. If I remove my app from the recent apps the BroadcastReceiver will stop working. How can I keep the BroadcastReceiver in background? I register the BroadcastReceiver from my main activity (in OnCreate()). IntentFilter intentFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); registerReceiver(receiver, intentFilter); BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { } }; This is not how you should register a receiver. You receiver

How to test Doze Mode on Android?

半城伤御伤魂 提交于 2019-11-30 21:01:41
There is an old Android app which work background 2 service (Service). It took to update the app with the possibility of sending data and logging while working is not a new DozeMode. Before you amend the current code I decided to check how everything will work now. To run the application, in the logs I see that both services are running (the basic meaning of the service to read the position of the device, the second service sends the data to the server). Turn off the screen with the command adb shell dumpsys deviceidle step translate the system to DozeMode: Nikita:app NG$ adb shell dumpsys

How to handle IPC between a service and an activity (and its subactivity)?

≡放荡痞女 提交于 2019-11-30 20:25:39
Communication between two different processes (a service and an activity) in Android can be managed via Messenger or AIDL : it is sufficient that an activity binds to a service. However, what happens if this activity has one or more sub-activity? From the moment when the main activity starts a sub-activity, I would like the communication to be redirected to the sub-activity; similarly, when the sub-activity is destroyed, I would like the communication is redirected back to the main activity, etc.. Example # 1: MyService <---IPC---> MainActivity MainActivity launches SubActivity, then MyService