@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); }
@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); }
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); } }
@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); } }
/** * Call requires API level 16 * * @param callback */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void startBeamPushCallBack(CreateBeamUrisCallback callback) { mNfcAdapter.setBeamPushUrisCallback(callback, mActivity); }