Java 类android.nfc.NfcAdapter.CreateBeamUrisCallback 实例源码

项目:Camera2    文件:CameraActivity.java   
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void setupNfcBeamPush() {
    NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mAppContext);
    if (adapter == null) {
        return;
    }

    if (!ApiHelper.HAS_SET_BEAM_PUSH_URIS) {
        // Disable beaming
        adapter.setNdefPushMessage(null, CameraActivity.this);
        return;
    }

    adapter.setBeamPushUris(null, CameraActivity.this);
    adapter.setBeamPushUrisCallback(new CreateBeamUrisCallback() {
        @Override
        public Uri[] createBeamUris(NfcEvent event) {
            return mNfcPushUris;
        }
    }, CameraActivity.this);
}
项目:nexus-camera    文件:CameraActivity.java   
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void setupNfcBeamPush() {
    NfcAdapter adapter = NfcAdapter.getDefaultAdapter(CameraActivity.this);
    if (adapter == null) {
        return;
    }

    if (!ApiHelper.HAS_SET_BEAM_PUSH_URIS) {
        // Disable beaming
        adapter.setNdefPushMessage(null, CameraActivity.this);
        return;
    }

    adapter.setBeamPushUris(null, CameraActivity.this);
    adapter.setBeamPushUrisCallback(new CreateBeamUrisCallback() {
        @Override
        public Uri[] createBeamUris(NfcEvent event) {
            return mNfcPushUris;
        }
    }, CameraActivity.this);
}
项目:nexus-gallery    文件:SelectionManager.java   
public SelectionManager(Activity activity) {
    mActivity = activity;
    if (ApiHelper.AT_LEAST_16) {
        mNfcAdapter = NfcAdapter.getDefaultAdapter(mActivity);
        mNfcAdapter.setBeamPushUrisCallback(new CreateBeamUrisCallback() {
            @Override
            public Uri[] createBeamUris(NfcEvent arg0) {
             // This will have been preceded by a call to onItemSelectedStateChange
                if (mCachedShareableUris == null) return null;
                return mCachedShareableUris.toArray(
                        new Uri[mCachedShareableUris.size()]);
            }
        }, mActivity);
    }
}
项目:nexus-gallery    文件:PhotoPage.java   
@TargetApi(ApiHelper.VERSION_CODES.JELLY_BEAN)
private void setupNfcBeamPush() {
    if (!ApiHelper.HAS_SET_BEAM_PUSH_URIS) return;

    NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mActivity);
    if (adapter != null) {
        adapter.setBeamPushUris(null, mActivity);
        adapter.setBeamPushUrisCallback(new CreateBeamUrisCallback() {
            @Override
            public Uri[] createBeamUris(NfcEvent event) {
                return mNfcPushUris;
            }
        }, mActivity);
    }
}
项目:libNfc    文件:Nfc.java   
/**
 * Call requires API level 16
 * 
 * @param callback
 */
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void startBeamPushCallBack(CreateBeamUrisCallback callback) {
    mNfcAdapter.setBeamPushUrisCallback(callback, mActivity);
}