android sdk manager 大集合

android下有许许多多的manager 可以很方便的实现很多功能,如果不知道很容易走弯路或者毫无头绪。

这个是在android developers里面搜索manager得到的结果 整理一下:
1.DownloadManager
The download manager is a system service that handles long-running HTTP downloads. Clients may request that a URI be downloaded to a particular destination file. The download manager will conduct the download in the background, taking care of HTTP interactions and retrying downloads after failures or across connectivity changes and system reboots. Instances of this class should be obtained through  getSystemService(String)  by passing  DOWNLOAD_SERVICE . Apps that request downloads through this API should register a broadcast receiver for  ACTION_NOTIFICATION_CLICKED  to appropriately handle when the user clicks on a running download in a notification or from the downloads UI. Note that the application must have the  INTERNET  permission to use this class.

2.LocationManager

This class provides access to the system location services. These services allow applications to obtain periodic updates of the device's geographical location, or to fire an application-specified Intent when the device enters the proximity of a given geographical location.

You do not instantiate this class directly; instead, retrieve it through Context.getSystemService(Context.LOCATION_SERVICE).

Unless noted, all Location API methods require the ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permissions. If your application only has the coarse permission then it will not have access to the GPS or passive location providers. Other providers will still return location results, but the update rate will be throttled and the exact location will be obfuscated to a coarse level of accuracy.

3.SensorManager

SensorManager lets you access the device's sensors. Get an instance of this class by calling Context.getSystemService() with the argument SENSOR_SERVICE.

Always make sure to disable sensors you don't need, especially when your activity is paused. Failing to do so can drain the battery in just a few hours. Note that the system will not disable sensors automatically when the screen turns off.

4.LoaderManager

Interface associated with an Activity or Fragment for managing one or more Loader instances associated with it. This helps an application manage longer-running operations in conjunction with the Activity or Fragment lifecycle; the most common use of this is with a CursorLoader, however applications are free to write their own loaders for loading other types of data. While the LoaderManager API was introduced in HONEYCOMB, a version of the API at is also available for use on older platforms through FragmentActivity. See the blog post Fragments For All for more details.

As an example, here is the full implementation of a Fragment that displays a ListView containing the results of a query against the contacts content provider. It uses a CursorLoader to manage the query on the provider.

5.AlarmManager

This class provides access to the system alarm services. These allow you to schedule your application to be run at some point in the future. When an alarm goes off, the Intent that had been registered for it is broadcast by the system, automatically starting the target application if it is not already running. Registered alarms are retained while the device is asleep (and can optionally wake the device up if they go off during that time), but will be cleared if it is turned off and rebooted.

The Alarm Manager holds a CPU wake lock as long as the alarm receiver's onReceive() method is executing. This guarantees that the phone will not sleep until you have finished handling the broadcast. Once onReceive() returns, the Alarm Manager releases this wake lock. This means that the phone will in some cases sleep as soon as your onReceive() method completes. If your alarm receiver called Context.startService(), it is possible that the phone will sleep before the requested service is launched. To prevent this, your BroadcastReceiver and Service will need to implement a separate wake lock policy to ensure that the phone continues running until the service becomes available.

Note: The Alarm Manager is intended for cases where you want to have your application code run at a specific time, even if your application is not currently running. For normal timing operations (ticks, timeouts, etc) it is easier and much more efficient to use Handler.

You do not instantiate this class directly; instead, retrieve it through Context.getSystemService(Context.ALARM_SERVICE).

6.FragmentManager
Interface for interacting with Fragment objects inside of an Activity

7.AccountManager
This class provides access to a centralized registry of the user's online accounts. The user enters credentials (username and password) once per account, granting applications access to online resources with "one-click" approval.

8.NotificationManager

Class to notify the user of events that happen. This is how you tell the user that something has happened in the background.

Notifications can take different forms:

  • A persistent icon that goes in the status bar and is accessible through the launcher, (when the user selects it, a designated Intent can be launched),
  • Turning on or flashing LEDs on the device, or
  • Alerting the user by flashing the backlight, playing a sound, or vibrating.

Each of the notify methods takes an int id parameter and optionally a String tag parameter, which may be null. These parameters are used to form a pair (tag, id), or (null, id) if tag is unspecified. This pair identifies this notification from your app to the system, so that pair should be unique within your app. If you call one of the notify methods with a (tag, id) pair that is currently active and a new set of notification parameters, it will be updated. For example, if you pass a new status bar icon, the old icon in the status bar will be replaced with the new one. This is also the same tag and id you pass to the cancel(int) orcancel(String, int) method to clear this notification.

You do not instantiate this class directly; instead, retrieve it through getSystemService(String).


9.WindowManager

The interface that apps use to talk to the window manager.

Use Context.getSystemService(Context.WINDOW_SERVICE) to get one of these.

Each window manager instance is bound to a particular Display. To obtain a WindowManager for a different display, use createDisplayContext(Display) to obtain aContext for that display, then use Context.getSystemService(Context.WINDOW_SERVICE) to get the WindowManager.

The simplest way to show a window on another display is to create a Presentation. The presentation will automatically obtain a WindowManager and Context for that display.

10.PackageManager
Class for retrieving various kinds of information related to the application packages that are currently installed on the device. You can find this class throughgetPackageManager().

11.TrustManager

The marker interface for JSSE trust managers. The purpose is to group trust managers. The responsibility a trust manager is to handle the trust data used to make trust decisions for deciding whether credentials of a peer should be accepted,

12.CookieSyncManager

The CookieSyncManager is used to synchronize the browser cookie store between RAM and permanent storage. To get the best performance, browser cookies are saved in RAM. A separate thread saves the cookies between, driven by a timer.

To use the CookieSyncManager, the host application has to call the following when the application starts:

CookieSyncManager.createInstance(context)

To set up for sync, the host application has to call

CookieSyncManager.getInstance().startSync()

in Activity.onResume(), and call

 CookieSyncManager.getInstance().stopSync()
 

in Activity.onPause().

To get instant sync instead of waiting for the timer to trigger, the host can call

CookieSyncManager.getInstance().sync()

The sync interval is 5 minutes, so you will want to force syncs manually anyway, for instance in onPageFinished(WebView, String). Note that even sync() happens asynchronously, so don't do it just as your activity is shutting down.

13.ViewManager
Interface to let you add and remove child views to an Activity. To get an instance of this class, call Context.getSystemService().

14.ConnectivityManager

Class that answers queries about the state of network connectivity. It also notifies applications when network connectivity changes. Get an instance of this class by calling Context.getSystemService(Context.CONNECTIVITY_SERVICE).

The primary responsibilities of this class are to:

  1. Monitor network connections (Wi-Fi, GPRS, UMTS, etc.)
  2. Send broadcast intents when network connectivity changes
  3. Attempt to "fail over" to another network when connectivity to a network is lost
  4. Provide an API that allows applications to query the coarse-grained or fine-grained state of the available networks
15.SearchManager

This class provides access to the system search services.

In practice, you won't interact with this class directly, as search services are provided through methods in Activity and the ACTION_SEARCH Intent. If you do require direct access to the SearchManager, do not instantiate this class directly. Instead, retrieve it throughcontext.getSystemService(Context.SEARCH_SERVICE).

16.NfcManager

High level manager used to obtain an instance of an NfcAdapter.

Use getSystemService(java.lang.String) with NFC_SERVICE to create an NfcManager, then call getDefaultAdapter() to obtain the NfcAdapter.

Alternately, you can just call the static helper getDefaultAdapter(android.content.Context).

17.PreferenceManager
Used to help create Preference hierarchies from activities or XML.

18.SingleClientConnManager

A connection "manager" for a single connection. This manager is good only for single-threaded use. Allocation always returns the connection immediately, even if it has not been released after the previous allocation. In that case, a warning is logged and the previously issued connection is revoked.

This class is derived from SimpleHttpConnectionManager in HttpClient 3. See there for original authors.

19.AudioManager

AudioManager provides access to volume and ringer mode control.

Use Context.getSystemService(Context.AUDIO_SERVICE) to get an instance of this class.

20.AccessibilityManager

System level service that serves as an event dispatch for AccessibilityEvents, and provides facilities for querying the accessibility state of the system. Accessibility events are generated when something notable happens in the user interface, for example an Activity starts, the focus or selection of a Viewchanges etc. Parties interested in handling accessibility events implement and register an accessibility service which extends AccessibilityService.

To obtain a handle to the accessibility manager do the following:

AccessibilityManager accessibilityManager =
        (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
21.InputManager

Provides information about input devices and available key layouts.

Get an instance of this class by calling Context.getSystemService() with the argument INPUT_SERVICE.

22.DisplayManager

Manages the properties of attached displays.

Get an instance of this class by calling Context.getSystemService() with the argument DISPLAY_SERVICE.

23.LocalBroadcastManager

Helper to register for and send broadcasts of Intents to local objects within your process. This is has a number of advantages over sending global broadcasts with sendBroadcast(Intent):

  • You know that the data you are broadcasting won't leave your app, so don't need to worry about leaking private data.
  • It is not possible for other applications to send these broadcasts to your app, so you don't need to worry about having security holes they can exploit.
  • It is more efficient than sending a global broadcast through the system.
24.AssetManager
Provides access to an application's raw asset files; see Resources for the way most applications will want to retrieve their resource data. This class presents a lower-level API that allows you to open and read raw files that have been bundled with the application as a simple stream of bytes.

总共24个,搜索在2013-5-5 17:55
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值