use of android.nfc.NfcAdapter.CreateBeamUrisCallback in project android_packages_apps_Gallery2 by LineageOS.
the class PhotoPage method setupNfcBeamPush.
@TargetApi(ApiHelper.VERSION_CODES.JELLY_BEAN)
private void setupNfcBeamPush() {
if (!ApiHelper.HAS_SET_BEAM_PUSH_URIS)
return;
try {
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);
}
} catch (NullPointerException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
use of android.nfc.NfcAdapter.CreateBeamUrisCallback in project android_packages_apps_Snap by LineageOS.
the class CameraActivity method setupNfcBeamPush.
@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);
}
Aggregations