本文整理汇总了Java中android.nfc.tech.NfcF类的典型用法代码示例。如果您正苦于以下问题:Java NfcF类的具体用法?Java NfcF怎么用?Java NfcF使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NfcF类属于android.nfc.tech包,在下文中一共展示了NfcF类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setForegroundListener
import android.nfc.tech.NfcF; //导入依赖的package包/类
private void setForegroundListener() {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
boolean handleFormatable = preferences.getBoolean("format_ndef_formatable_tags", false);
pi = PendingIntent.getActivity(this, 0, new Intent(this,getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
intentFiltersArray = null;
if(handleFormatable)
techList = new String[][]{ new String[]{ NfcA.class.getName(),Ndef.class.getName()},
new String[]{ NfcB.class.getName(),Ndef.class.getName()},
new String[]{ NfcF.class.getName(),Ndef.class.getName()},
new String[]{ NfcV.class.getName(),Ndef.class.getName()},
new String[]{ NfcA.class.getName(),NdefFormatable.class.getName()},
new String[]{ NfcB.class.getName(),NdefFormatable.class.getName()},
new String[]{ NfcF.class.getName(),NdefFormatable.class.getName()},
new String[]{ NfcV.class.getName(),NdefFormatable.class.getName()}};
else
techList = new String[][]{ new String[]{ NfcA.class.getName(),Ndef.class.getName()},
new String[]{ NfcB.class.getName(),Ndef.class.getName()},
new String[]{ NfcF.class.getName(),Ndef.class.getName()},
new String[]{ NfcV.class.getName(),Ndef.class.getName()}};
}
开发者ID:OlivierGonthier,项目名称:CryptoNFC,代码行数:22,代码来源:MainActivity.java
示例2: initializeNFC
import android.nfc.tech.NfcF; //导入依赖的package包/类
public void initializeNFC() {
if (nfcInit == false) {
PackageManager pm = getPackageManager();
nfcSupported = pm.hasSystemFeature(PackageManager.FEATURE_NFC);
if (nfcSupported == false) {
return;
}
// when is in foreground
MLog.d(TAG, "starting NFC");
mAdapter = NfcAdapter.getDefaultAdapter(this);
// PedingIntent will be delivered to this activity
mPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
// Setup an intent filter for all MIME based dispatches
IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
try {
ndef.addDataType("*/*");
} catch (IntentFilter.MalformedMimeTypeException e) {
throw new RuntimeException("fail", e);
}
mFilters = new IntentFilter[]{ ndef, };
// Setup a tech list for all NfcF tags
mTechLists = new String[][]{new String[]{NfcF.class.getName()}};
nfcInit = true;
}
}
开发者ID:victordiaz,项目名称:phonk,代码行数:32,代码来源:AppRunnerActivity.java
示例3: onCreate
import android.nfc.tech.NfcF; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedState) {
super.onCreate(savedState);
setContentView(R.layout.foreground_dispatch);
mText = (TextView) findViewById(R.id.text);
mText.setText("Scan a tag");
mAdapter = NfcAdapter.getDefaultAdapter(this);
// Create a generic PendingIntent that will be deliver to this activity. The NFC stack
// will fill in the intent with the details of the discovered tag before delivering to
// this activity.
mPendingIntent = PendingIntent.getActivity(this, 0,
new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
// Setup an intent filter for all MIME based dispatches
IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
try {
ndef.addDataType("*/*");
} catch (MalformedMimeTypeException e) {
throw new RuntimeException("fail", e);
}
mFilters = new IntentFilter[] {
ndef,
};
// Setup a tech list for all NfcF tags
mTechLists = new String[][] { new String[] { NfcF.class.getName() } };
}
开发者ID:appledong,项目名称:AndroidthingsStudy,代码行数:31,代码来源:ForegroundDispatch.java
示例4: onCreate
import android.nfc.tech.NfcF; //导入依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Create NFC Adapter
mAdapter = NfcAdapter.getDefaultAdapter(this);
// Pending intent
mPendingIntent = PendingIntent.getActivity(this, 0,
new Intent(this, ScanActivity.class).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
// Setup an intent filter for all MIME based dispatches (TEXT);
IntentFilter ndefText = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
try {
ndefText.addDataType("*/*");
} catch (MalformedMimeTypeException e) {
}
// Setup an intent filter for all MIME based dispatches (URI);
IntentFilter ndefURI = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
ndefURI.addDataScheme("http");
ndefURI.addDataScheme("https");
mFilters = new IntentFilter[] { ndefText, ndefURI};
// Setup a tech list for all NfcF tags
mTechLists = new String[][] { new String[] { NfcF.class.getName() } };
}
开发者ID:twisprite-developers,项目名称:anroid-nfc-plugin,代码行数:28,代码来源:ScanActivity.java
示例5: onCreate
import android.nfc.tech.NfcF; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedState) {
super.onCreate(savedState);
setContentView(R.layout.foreground_dispatch);
mText = (TextView) findViewById(R.id.text);
mText.setText("Scan a tag");
mAdapter = NfcAdapter.getDefaultAdapter(this);
// Create a generic PendingIntent that will be deliver to this activity. The NFC stack
// will fill in the intent with the details of the discovered tag before delivering to
// this activity.
mPendingIntent = org.bbs.apklauncher.emb.PendingIntentHelper.getActivity(this, 0,
new org.bbs.apklauncher.emb.IntentHelper(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
// Setup an intent filter for all MIME based dispatches
IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
try {
ndef.addDataType("*/*");
} catch (MalformedMimeTypeException e) {
throw new RuntimeException("fail", e);
}
mFilters = new IntentFilter[] {
ndef,
};
// Setup a tech list for all NfcF tags
mTechLists = new String[][] { new String[] { NfcF.class.getName() } };
}
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:31,代码来源:ForegroundDispatch.java
示例6: readCard
import android.nfc.tech.NfcF; //导入依赖的package包/类
static void readCard(NfcF tech, Card card) throws IOException {
final FeliCa.Tag tag = new FeliCa.Tag(tech);
tag.connect();
/*
*
FeliCa.SystemCode systems[] = tag.getSystemCodeList();
if (systems.length == 0) {
systems = new FeliCa.SystemCode[] { new FeliCa.SystemCode(
tag.getSystemCodeByte()) };
}
for (final FeliCa.SystemCode sys : systems)
card.addApplication(readApplication(tag, sys.toInt()));
*/
// better old card compatibility
card.addApplication(readApplication(tag, SYS_OCTOPUS));
try {
card.addApplication(readApplication(tag, SYS_SZT));
} catch (IOException e) {
// for early version of OCTOPUS which will throw shit
}
tag.close();
}
开发者ID:sinpolib,项目名称:nfcard,代码行数:30,代码来源:FelicaReader.java
示例7: onCreate
import android.nfc.tech.NfcF; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set full screen
setTheme(android.R.style.Theme_NoTitleBar_Fullscreen);
getWindow ().setFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
// Get layout id
int layoutID = getResources().getIdentifier("activity_scan_nfc", "layout", getPackageName());
// Load layout
RelativeLayout layout = (RelativeLayout) LayoutInflater.from(this).inflate(layoutID, null);
// Set layout as content view
setContentView(layout, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
// Create NFC Adapter
mAdapter = NfcAdapter.getDefaultAdapter(this);
if (mAdapter == null) {
finishWithResult("NO_HARDWARE");
return;
}
// Create a generic PendingIntent that will be deliver to this activity. The NFC stack
// will fill in the intent with the details of the discovered tag before delivering to
// this activity.
mPendingIntent = PendingIntent.getActivity(this, 0,
new Intent(this, ScanNFCActivity.class).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
// Setup an intent filter for all MIME based dispatches (TEXT);
IntentFilter ndefText = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
try {
ndefText.addDataType("*/*");
} catch (MalformedMimeTypeException e) {
finishWithResult("ERROR");
return;
}
// Setup an intent filter for all MIME based dispatches (URI);
IntentFilter ndefURI = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
ndefURI.addDataScheme("http");
ndefURI.addDataScheme("https");
mFilters = new IntentFilter[] { ndefText, ndefURI};
// Setup a tech list for all NfcF tags
mTechLists = new String[][] { new String[] { NfcF.class.getName() } };
}
开发者ID:twisprite-developers,项目名称:anroid-nfc-plugin,代码行数:53,代码来源:ScanNFCActivity.java
示例8: Tag
import android.nfc.tech.NfcF; //导入依赖的package包/类
public Tag(NfcF tag) {
nfcTag = tag;
sys = tag.getSystemCode();
idm = new IDm(tag.getTag().getId());
pmm = new PMm(tag.getManufacturer());
}
开发者ID:sinpolib,项目名称:nfcard,代码行数:7,代码来源:FeliCa.java
示例9: load
import android.nfc.tech.NfcF; //导入依赖的package包/类
static String load(NfcF tech, Resources res) {
final FeliCa.Tag tag = new FeliCa.Tag(tech);
/*--------------------------------------------------------------*/
// check card system
/*--------------------------------------------------------------*/
final int system = tag.getSystemCode();
final FeliCa.ServiceCode service;
if (system == SYS_OCTOPUS)
service = new FeliCa.ServiceCode(SRV_OCTOPUS);
else if (system == SYS_SZT)
service = new FeliCa.ServiceCode(SRV_SZT);
else
return null;
tag.connect();
/*--------------------------------------------------------------*/
// read service data without encryption
/*--------------------------------------------------------------*/
final float[] data = new float[] { 0, 0, 0 };
final int N = data.length;
int p = 0;
for (byte i = 0; p < N; ++i) {
final FeliCa.ReadResponse r = tag.readWithoutEncryption(service, i);
if (!r.isOkey())
break;
data[p++] = (Util.toInt(r.getBlockData(), 0, 4) - 350) / 10.0f;
}
tag.close();
/*--------------------------------------------------------------*/
// build result string
/*--------------------------------------------------------------*/
final String name = parseName(system, res);
final String info = parseInfo(tag, res);
final String hist = parseLog(null, res);
final String cash = parseBalance(data, p, res);
return CardManager.buildResult(name, info, cash, hist);
}
开发者ID:Mrsunsunshine,项目名称:FrontOne,代码行数:48,代码来源:OctopusCard.java
示例10: load
import android.nfc.tech.NfcF; //导入依赖的package包/类
public static String load(Parcelable parcelable, Resources res) {
final Tag tag = (Tag) parcelable;
final IsoDep isodep = IsoDep.get(tag);
Log.d("NFCTAG", "ffff");//isodep.transceive("45".getBytes()).toString());
if (isodep != null) {
return PbocCard.load(isodep, res);
}
final NfcV nfcv = NfcV.get(tag);
if (nfcv != null) {
return VicinityCard.load(nfcv, res);
}
final NfcF nfcf = NfcF.get(tag);
if (nfcf != null) {
return OctopusCard.load(nfcf, res);
}
return null;
}
开发者ID:Mrsunsunshine,项目名称:FrontOne,代码行数:27,代码来源:CardManager.java
示例11: Tag
import android.nfc.tech.NfcF; //导入依赖的package包/类
public Tag(NfcF tag) {
nfcTag = tag;
sys = SystemCode.toInt(tag.getSystemCode());
idm = new IDm(tag.getTag().getId());
pmm = new PMm(tag.getManufacturer());
}
开发者ID:Mrsunsunshine,项目名称:FrontOne,代码行数:7,代码来源:FeliCa.java
示例12: getTechListArray
import android.nfc.tech.NfcF; //导入依赖的package包/类
public static String[][] getTechListArray() {
return new String[][]{new String[]{NfcF.class.getName()}};
}
开发者ID:ThibaudM,项目名称:timelapse-sony,代码行数:4,代码来源:NFCHandler.java
示例13: readCard
import android.nfc.tech.NfcF; //导入依赖的package包/类
private Card readCard(Tag tag) {
final Card card = new Card();
try {
publishProgress(SPEC.EVENT.READING);
card.setProperty(SPEC.PROP.ID, Util.toHexString(tag.getId()));
final IsoDep isodep = IsoDep.get(tag);
if (isodep != null)
StandardPboc.readCard(isodep, card);
final NfcF nfcf = NfcF.get(tag);
if (nfcf != null)
FelicaReader.readCard(nfcf, card);
publishProgress(SPEC.EVENT.IDLE);
} catch (Exception e) {
card.setProperty(SPEC.PROP.EXCEPTION, e);
publishProgress(SPEC.EVENT.ERROR);
}
return card;
}
开发者ID:sinpolib,项目名称:nfcard,代码行数:28,代码来源:ReaderManager.java
注:本文中的android.nfc.tech.NfcF类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论