I'd like to create a Java/Kotlin background service that is not afflicted by resource management limitations at all.
I know that this is pretty much contradicting Android design principles, and I am pretty sure this is not possible for a normal app.
But having full root permissions, what would be the cleanest way to build/install such a service? I would still like to use Android Studio to develop, and benefit from Java API portability.
Edit: It turned out that my question has been misleading. I am not targetting an existing Android HW Device, where a user has to grant permissions, but rather a custom AOSP installation, which i have full control of. I already figured out that I probably have to write a system service for this. However, I will accept the given answer for the general case as reference for others.
You can try using this approach and ask your user to add your application to the white list. Any app that is there won't be a subject of system resource management regarding the Doze mode; thus, the system won't kill your service while it's in background while you don't break the other limitations such as max amount of available memory.
Or you can just show an alert and ask the user to add your application to the white list manually.
Related
I'm only on search for the reason why Android does this and what can you do to "stop" it or handle it when coding any app. I haven't found any info about this except some yt videos that teach you how to stop it when using your Android smartphone. I'm looking for documentation or something like that to read and learn why does this happen and how to handle it.
Sorry for my bad english, not native. Thank you.
Why? Because a device is a computer and therefore the limited resources should be optimized. The optimizations favors the app with the user is interacting, making the user experience fluid.
How this happen and how to handle it is the life cycle
And how to make things even if the app is not open it is about the workmanager
From the official documentation
It is important that application developers understand how different application components (in particular Activity, Service, and BroadcastReceiver) impact the lifetime of the application's process. Not using these components correctly can result in the system killing the application's process while it is doing important work.
and how it happens :
To determine which processes should be killed when low on memory, Android places each process into an "importance hierarchy" based on the components running in them and the state of those components
I'm a non-android-programmer who needs to employ/partner with an android developer or development team to implement a project. What I am interested in knowing is how difficult my requirements are likely to be to implement. I have already approached several developers but so far haven't got any answers beyond "sorry we don't have time now" or "we'll get back to you". I believe it would help me to find a developer if someone could give me some indication of how difficult this project will be to implement.
There are two main requirements. Firstly, the software should monitor usage of the device (it will be a tablet computer) so that usage is recorded and regularly transmitted to me (e.g. by automatic email of a datafile). By usage I mean I want to know (a) what apps are installed and when, and (b) what apps are in use (in the foreground) and when. Secondly, the software should be able to restrict usage of the device so that it can be configured to only be able to run certain apps, and only at certain times. At other times it should be unlockable. It doesn't need to be hacker-proof, just child proof.
Skeptics will want to know why I want malicious-sounding spyware written for me: my attentions are good - I'm a child psychologist and we are planning to run a study where we look at how very small children use tablet computers in an ordinary family setting. Basically I will be handing tablets out to parents of three-year-olds: the parents will know exactly what we have done to the tablets.
To avoid asking too vague a question, I guess I could specify even further: is this even possible without a rewrite of the operating system itself (in which case I guess this is a big job), or can this be done more simply? Perhaps there is already software or libraries available which do this?
Certainly it's feasible, and I don't see why it would be as expensive as has been suggested. The key is that you need this only to be child-proof: that's far easier than making it hacker-proof.
All you'd need is a system service to log and transmit various events, and a replacement home/launcher app to prevent launch of unwanted apps. Simples.
Some applications in Android show the number of background applications running in the device. Is there any way to find it programmatically ?
Yeah, but you need a scary permission for your app in order to do it (http://developer.android.com/reference/android/Manifest.permission.html#GET_TASKS). Edit: this is scary because it is a permission that most apps shouldn't need, and from a user standpoint makes your app considerably less trustworthy unless you have a very obvious reason for needing it.
The method to achieve what you are after is: http://developer.android.com/reference/android/app/ActivityManager.html#getRunningTasks(int)
I would like to know the correct way to monitor system events and operating system activity in Android. My research so far indicates there are various methods for running Activities, Services, BroadCastReceivers, etc. but I don't have an overall comprehensive answer for everything I want to accomplish yet. I did come across an app today called "Carrier IQ" and was wondering how they do it. I believe their app is built into the kernel or at least the phone's OS image, something I want to avoid doing if at all possible.
I know that the Android SDK offers various ways to obtain
Since my app cannot be allowed to be suspended, should it run as a foreground service? If I do this, will I consume too many resources if I need to poll for various activity? I ask this because I don't think I can get everything through receiving events (i.e., using a BroadCastReceiver). I think I need a combination of polling and events.
I want to log sensors, events, OS activity, etc. for a user study. This is NOT for hacking or phishing purposes!
These are the top three projects that I think may accomplish something similar to what I want to achieve, but I have not yet determined if they are viable solutions:
android-hci-extractor
cellbots data logger
android-os-monitor
Does the Android manifest permissions list contain all of the permissions your app will need?
http://developer.android.com/reference/android/Manifest.permission.html
Then you can just ask for permissions when the app is installed and you should be able to access them.
I am using a phone without LED notifications. I would like to dev an app to simulate that, however first, with root, I would like to get access to the notifications system on the OS level (so it can be app-agnostic), to get the notifications.
How can I do so, or where can I read up more about this?
Thank you!
Despite this being old and already having an answer accepted, I want to offer an alternative solution since I think the end goal can be achieved. With all due respect to Mark, I think the direction the question is a little misleading, but the end goal is attainable.
If you are looking for something that would allow you to make an app that listens for notifications and then performs some action based on them regardless of the source app (or could be tailored to specific apps), then I think you can do this without writing firmware or rooting using an Accessibility Service. Accessibility Services would allow access to notifications as they come in, allowing your app to do something with them. You would be able to filter by the source package, get the notification contents, and a lot of other things.
There is a lot I could say on it, but it is still rather new to me, so I'll provide a couple of links to get started.
Accessibility Services page: http://developer.android.com/guide/topics/ui/accessibility/services.html
I would also recommend trying it out for yourself. I came across a small project file that I was able to copy and run on my own as a proof-of-concept. If you run this, you'll be able to see in the log that you really can read notifications: https://gist.github.com/qihnus/1909616
Don't forget to enable the accessibility feature for the app after you install it in your phone's accessibility settings.
You have to write your own firmware. This is not possible from an SDK application, rooted or not.