Example usage for android.content Intent setAllowFds

List of usage examples for android.content Intent setAllowFds

Introduction

In this page you can find the example usage for android.content Intent setAllowFds.

Prototype

@UnsupportedAppUsage
public void setAllowFds(boolean allowFds) 

Source Link

Usage

From source file:android.content.BroadcastReceiver.java

/**
 * Provide a binder to an already-running service.  This method is synchronous
 * and will not start the target service if it is not present, so it is safe
 * to call from {@link #onReceive}.//w  w  w  . j a v a2 s. c om
 * 
 * @param myContext The Context that had been passed to {@link #onReceive(Context, Intent)}
 * @param service The Intent indicating the service you wish to use.  See {@link
 * Context#startService(Intent)} for more information.
 */
public IBinder peekService(Context myContext, Intent service) {
    IActivityManager am = ActivityManagerNative.getDefault();
    IBinder binder = null;
    try {
        service.setAllowFds(false);
        binder = am.peekService(service, service.resolveTypeIfNeeded(myContext.getContentResolver()));
    } catch (RemoteException e) {
    }
    return binder;
}