use of android.nfc.NfcEvent in project i2p.i2p-bote by i2p.
the class ViewIdentityActivity method onCreate.
@SuppressLint("NewApi")
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState == null) {
String key = null;
Bundle args = getIntent().getExtras();
if (args != null)
key = args.getString(ViewIdentityFragment.ADDRESS);
if (key == null) {
setResult(RESULT_CANCELED);
finish();
return;
}
ViewIdentityFragment f = ViewIdentityFragment.newInstance(key);
getSupportFragmentManager().beginTransaction().add(android.R.id.content, f).commit();
}
mNfcAdapter = NfcAdapter.getDefaultAdapter(this);
if (mNfcAdapter != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
mNfcAdapter.setNdefPushMessageCallback(new NfcAdapter.CreateNdefMessageCallback() {
@Override
public NdefMessage createNdefMessage(NfcEvent nfcEvent) {
return getNdefMessage();
}
}, this);
}
}
Aggregations