Hi so I got a new phone but the apps I need to stay in the background keep on being killed. I have turned off battery optimization and used the don'tkillmyapp said it was 100% not much help. I looked around and someone mentioned that you can make apps stay in the background using adb. Can you please link a website on how to do that since I'm a beginner or you can just tell me how. Please and thank you.
Use Worker. You can use workers for a specific task or to run others periodically. Here I leave the link for more information.
https://www.google.com/url?sa=t&source=web&rct=j&url=https://developer.android.com/reference/androidx/work/Worker&ved=2ahUKEwiQjZyz6JbuAhUm2FkKHQheAnIQFjABegQIARAB&usg=AOvVaw3RUYn3s9t_S_Mks1x4p8H0
Related
I' am looking for solution to running custom process indefinetly in background, even if user quit from application. It would fetching data from the server and generate local notification. I' am working with Nativescript/Angular and I heard about Workers but as far as I know, they can't keep the process if the app is not in foreground. It would be greatful if the solution will be suitable for IOS and Android. Have you any ideas to do this? Thanks in advance for your involvement
iOS can not run something on background continuously. It's the OS which decides when your background execution can run. Refer BackgroundExecution docs for more info and samples.
On Android you are free to run it continuously at least until the user blocks it on his choice, sample implementation can be found here.
I want to know how much my application using battery of user's mobile programmatically. I search for it but not able to find any specific solution for it.
If you are trying to configure usage for your battery from your app, you cannot. If
you are trying to know how much battery is left in your device you
can.
Suggestion: One thing you can do is start a session once your app opens and end it when you close. That way you can know how much battery was used. Again, other factors like background apps and multitasking comes into play hence you cannot identify it. Maybe these links can help you.
https://developer.android.com/topic/performance/power/battery-historian
https://developer.android.com/training/monitoring-device-state/battery-monitoring#java
Again I might be wrong here. Comments and edits are welcome.
I would like to send a notification at a certain time (That I can specify) that can send even when the app is not in use. I have seen a few examples of this, but not in kivy. If anyone could give me some example code of this (in python and kivy) that would be great! Thanks in advance!
You'll want to look into making a background service for Android and the equivalent in ios. I've given a rough breakdown on how to do this in this thread here https://www.reddit.com/r/kivy/comments/asojmg/examples_of_kivy_with_service_backend/
If you want to do this on linux\pc\macos I'm not sure about that but I'm sure there's similar background services for them too.
I want to create an app can help me control my Facebook addiction and waste time on my phone. So I want to create an android application start when I open an app like Facebook or Twitter , when I open Facebook, my app will start timing and tell me after a time that I setting in it. Can I do that, or should I run my app on the background. I'm new to android so I don't know where to find information or keyword to research.
Sorry for my bad English.
Hey there is no direct way of doing it, but you have to figure out the solution for that by running a service and accessing stats
refer this thread for detail
this thread
this particular latest answer on that
latest answer
you may have to figure out a solution for that and its possible, many apps are doing it.
upvoted your question, because i liked the question and idea. Please post back the best solution you implement, so that someone in the future might benefit of it and the i guess few of the solutions given are already outdated now.
i have a question. I'm developing an Android Application. Actually, i have a thread in background that makes request to an external API in order to get data when the users clicks in different parts of the app.
My doubt is if this "thread" would be better if i implemented it as a service instead of a Runnable class.
Thanks
The point of a service is that it can run while your app is not resident. If you only want the service to run while your app is open then a thread is the probably the best way to do it.
As i learned some days ago, using AsyncTasks is the preferred, painless way in android to do background tasks. Have a look here to get a good tutorial.
http://android-developers.blogspot.com/2009/05/painless-threading.html
bye
If your information can be used by any other application you could use a service or as they are called in Android, a Content Provider. This way you make the information available to all the applications on the phone. This is a great way of encouraging other developers to build their applications with the info that you've provided. This is just something that you should consider, if it's something strictly related to you're application you can go on with the thread just as CaseyB stated.