I am looking into mobile app development, and I had some questions about the android platform.
Does the android platform use a central settings and preferences page (much like the gears icon on an iOS device)?
I've been reading about services. Are these what I would use if I wanted to develop an application that doesn't have a UI (think something like the drop box client)?
In my reading about services I read that the android OS will kill your service when it thinks that it needs to reclaim resources. Is there a 开发者_运维百科way to ensure a service wouldn't be killed?
How much control would I as a developer have over the physical hardware? Say if I wanted to make an app to block distractions, and to do this I would need to control the networking interfaces beyond purposely misconfiguring these interfaces to block their connection? Can I programmatically turn off these interfaces?
Each individual application has its own settings page, but this is generally created by using the built-in Android settings class (you can just subclass
PreferenceActivity
)Every application must have an activity (A screen with a UI), but yes, you can do the majority of your work in a service, which is analogous to a background process on a desktop computer
There is no way to ensure that Android won't kill your service without rooting the phone. However,
"If the service is bound to an activity that has user focus, then it's less likely to be killed, and if the service is declared to run in the foreground (discussed later), then it will almost never be killed" link
- Yes, you have access to any hardware (GPS, WiFi, Bluetooth, 3G radios, camera, etc) through the Android API. You will have to request an install time permission from the user in order to deal with them, however. Also, other programs can turn them back on.
精彩评论