Build 1.0_r1(from source)

android.app
Class ReceiverRestrictedContext

java.lang.Object
  extended by android.content.Context
      extended by android.content.ContextWrapper
          extended by android.app.ReceiverRestrictedContext

 class ReceiverRestrictedContext
extends ContextWrapper


Field Summary
 
Fields inherited from class android.content.Context
ACTIVITY_SERVICE, ALARM_SERVICE, AUDIO_SERVICE, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BLUETOOTH_SERVICE, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, KEYGUARD_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MODE_APPEND, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NOTIFICATION_SERVICE, POWER_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, STATUS_BAR_SERVICE, TELEPHONY_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
 
Constructor Summary
ReceiverRestrictedContext(Context base)
           
 
Method Summary
 boolean bindService(Intent service, ServiceConnection conn, int flags)
          Connect to an application service, creating it if needed.
 Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter)
          Register an BroadcastReceiver to be run in the main activity thread.
 Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter, String broadcastPermission, Handler scheduler)
          Register to receive intent broadcasts, to run in the context of scheduler.
 
Methods inherited from class android.content.ContextWrapper
attachBaseContext, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkUriPermission, checkUriPermission, clearWallpaper, createPackageContext, databaseList, deleteDatabase, deleteFile, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getAssets, getBaseContext, getCacheDir, getClassLoader, getContentResolver, getDatabasePath, getDir, getFilesDir, getFileStreamPath, getMainLooper, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getSystemService, getTheme, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, openFileInput, openFileOutput, openOrCreateDatabase, peekWallpaper, removeStickyBroadcast, revokeUriPermission, sendBroadcast, sendBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendStickyBroadcast, setTheme, setWallpaper, setWallpaper, startActivity, startInstrumentation, startService, stopService, unbindService, unregisterReceiver
 
Methods inherited from class android.content.Context
getString, getString, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReceiverRestrictedContext

ReceiverRestrictedContext(Context base)
Method Detail

registerReceiver

public Intent registerReceiver(BroadcastReceiver receiver,
                               IntentFilter filter)
Description copied from class: Context
Register an BroadcastReceiver to be run in the main activity thread. The receiver will be called with any broadcast Intent that matches filter, in the main application thread.

The system may broadcast Intents that are "sticky" -- these stay around after the broadcast as finished, to be sent to any later registrations. If your IntentFilter matches one of these sticky Intents, that Intent will be returned by this function and sent to your receiver as if it had just been broadcast.

There may be multiple sticky Intents that match filter, in which case each of these will be sent to receiver. In this case, only one of these can be returned directly by the function; which of these that is returned is arbitrarily decided by the system.

If you know the Intent your are registering for is sticky, you can supply null for your receiver. In this case, no receiver is registered -- the function simply returns the sticky Intent that matches filter. In the case of multiple matches, the same rules as described above apply.

See BroadcastReceiver for more information on Intent broadcasts.

Note: this method can not be called from an BroadcastReceiver component. It is okay, however, to use this method from another BroadcastReceiver that has itself been registered with Context.registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter), since the lifetime of such an BroadcastReceiver is tied to another object (the one that registered it).

Overrides:
registerReceiver in class ContextWrapper
Parameters:
receiver - The BroadcastReceiver to handle the broadcast.
filter - Selects the Intent broadcasts to be received.
Returns:
The first sticky intent found that matches filter, or null if there are none.
See Also:
Context.registerReceiver(BroadcastReceiver, IntentFilter, String, Handler), Context.sendBroadcast(android.content.Intent), Context.unregisterReceiver(android.content.BroadcastReceiver)

registerReceiver

public Intent registerReceiver(BroadcastReceiver receiver,
                               IntentFilter filter,
                               String broadcastPermission,
                               Handler scheduler)
Description copied from class: Context
Register to receive intent broadcasts, to run in the context of scheduler. See Context.registerReceiver(BroadcastReceiver, IntentFilter) for more information. This allows you to enforce permissions on who can broadcast intents to your receiver, or have the receiver run in a different thread than the main application thread.

See BroadcastReceiver for more information on Intent broadcasts.

Overrides:
registerReceiver in class ContextWrapper
Parameters:
receiver - The BroadcastReceiver to handle the broadcast.
filter - Selects the Intent broadcasts to be received.
broadcastPermission - String naming a permissions that a broadcaster must hold in order to send an Intent to you. If null, no permission is required.
scheduler - Handler identifying the thread that will receive the Intent. If null, the main thread of the process will be used.
Returns:
The first sticky intent found that matches filter, or null if there are none.
See Also:
Context.registerReceiver(BroadcastReceiver, IntentFilter), Context.sendBroadcast(android.content.Intent), Context.unregisterReceiver(android.content.BroadcastReceiver)

bindService

public boolean bindService(Intent service,
                           ServiceConnection conn,
                           int flags)
Description copied from class: Context
Connect to an application service, creating it if needed. This defines a dependency between your application and the service. The given conn will receive the service object when its created and be told if it dies and restarts. The service will be considered required by the system only for as long as the calling context exists. For example, if this Context is an Activity that is stopped, the service will not be required to continue running until the Activity is resumed.

This function will throw SecurityException if you do not have permission to bind to the given service.

Note: this method can not be called from an BroadcastReceiver component. A pattern you can use to communicate from an BroadcastReceiver to a Service is to call Context.startService(android.content.Intent) with the arguments containing the command to be sent, with the service calling its Service.stopSelf(int) method when done executing that command. See the API demo App/Service/Service Start Arguments Controller for an illustration of this. It is okay, however, to use this method from an BroadcastReceiver that has been registered with Context.registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter), since the lifetime of this BroadcastReceiver is tied to another object (the one that registered it).

Overrides:
bindService in class ContextWrapper
Parameters:
service - Identifies the service to connect to. The Intent may specify either an explicit component name, or a logical description (action, category, etc) to match an IntentFilter published by a service.
conn - Receives information as the service is started and stopped.
flags - Operation options for the binding. May be 0 or Context.BIND_AUTO_CREATE.
Returns:
If you have successfully bound to the service, true is returned; false is returned if the connection is not made so you will not receive the service object.
See Also:
Context.unbindService(android.content.ServiceConnection), Context.startService(android.content.Intent), Context.BIND_AUTO_CREATE

Build 1.0_r1(from source)

Please submit a feedback, bug or feature