本文整理匯總了Java中android.nfc.NfcAdapter.disableForegroundDispatch方法的典型用法代碼示例。如果您正苦於以下問題:Java NfcAdapter.disableForegroundDispatch方法的具體用法?Java NfcAdapter.disableForegroundDispatch怎麽用?Java NfcAdapter.disableForegroundDispatch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.nfc.NfcAdapter
的用法示例。
在下文中一共展示了NfcAdapter.disableForegroundDispatch方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: enableDisableForegroundDispatch
import android.nfc.NfcAdapter; //導入方法依賴的package包/類
private void enableDisableForegroundDispatch(boolean enable) {
Log.i(LOG_TAG, "enableForegroundDispatch, enable = " + enable);
NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(context);
Activity currentActivity = getCurrentActivity();
if (nfcAdapter != null && !currentActivity.isFinishing()) {
try {
if (enable) {
nfcAdapter.enableForegroundDispatch(currentActivity, getPendingIntent(), getIntentFilters(), getTechLists());
} else {
nfcAdapter.disableForegroundDispatch(currentActivity);
}
} catch (IllegalStateException e) {
Log.w(LOG_TAG, "Illegal State Exception starting NFC. Assuming application is terminating.");
}
}
}
示例2: stopForegroundDispatch
import android.nfc.NfcAdapter; //導入方法依賴的package包/類
public void stopForegroundDispatch() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) {
NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(activity);
if (nfcAdapter != null) {
if (isForeground) {
nfcAdapter.disableForegroundDispatch(activity);
isForeground = false;
}
}
}
}
示例3: stopForegroundDispatch
import android.nfc.NfcAdapter; //導入方法依賴的package包/類
private static void stopForegroundDispatch(final Activity activity, NfcAdapter adapter)
{
adapter.disableForegroundDispatch(activity);
}
示例4: stopForegroundDispatch
import android.nfc.NfcAdapter; //導入方法依賴的package包/類
/**
* @param activity The corresponding {@link BaseActivity} requesting to stop the foreground dispatch.
* @param adapter The {@link NfcAdapter} used for the foreground dispatch.
*/
public static void stopForegroundDispatch(final Activity activity, NfcAdapter adapter) {
adapter.disableForegroundDispatch(activity);
}