Is there a good sample application or tutorial for creating android Service that run in the background?
The Android API Demos include a Remote Service sample. I think we used it as the starting point for our background service. There is also example code right in the documentation for the Service class.
Well, I don't know any apart from my own application. But that is real applications with all the extra code that comes with it and not sample as such.
If you still want to have a go you I suggest you look for Service_Intend and Service_Connection in Calculator_Activity.java and for Calculator_Thread and Binder in Calculator_Service.java. That should give you some idea.
Related
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'm currently trying to learn how to write custom services and have them start up at boot, all in the Android Source code.
Could anyone point me to the right references (books, online articles, etc) that discuss this specific topic and as well as understanding AOSP/Android operating system in general?
To learn how to write a custom Service you can look at the docs here.
You'll want to learn about Activities and their Lifecycle in the docs here
And you'll want to learn about the Application fundamentals in the docs here
Once you have an idea of how everything works fundamentally, there are tons of tutorials on the internet that will show you how to code specific things. A simple Google search will find you all of that.
Hope this helps!
I found lots of books on android which give basic concept on android Example (calling Activity, Intent, service, broadcast receivers etc). But I want to know brief description on all these concept. in os level or in api level how does it work. Also how connection with wifi or 3g works in api level.
I want to know brief understanding on android. Can anyone suggest any tutorial or book to get detail understanding on android.
Thanks
Start with the Android Developer's Guide. http://developer.android.com/guide/index.html
I would recommend to buy a book. For me Professional Android 2 Application Development was really good. But probably now there is better (up to date) alternative.
Anyway I find reading books much easier starter than separate tutorials and articles.
If you want a really detailed view, just look at the source code.
I have an android tablet and have an application installed on it... Now i need to control this application on the tablet through my android device... is there a way to do such thing?
Explore this example project by Google
http://developer.android.com/resources/samples/BluetoothChat/index.html
see how it works and try to implement your programming skill to transform this chat application to your idea...
How ever I am assuming that you are the author of application which you have desire to control.
happy coding.
EDITED:
Logic structure is simple both application should be able to detect bluetooth and paired(connect) with each other for communication. once you have communication instead of sending message(in chat) you send some information via buttons which will execute some methods on tablet...Just a thought... As if in chat application you can update and add messages to your thread...this application will help you to reach goal. Lot of work though!
If you are familiar with Sockets, this shouldn't be a problem for you, because the Bluetooth-connection and communication in Android is very much the same. See the Bluetooth-Tutorial and Googles "Bluetooth-Chat" example.
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.