可以在应用内禁用Android Pay吗? [英] Can Android Pay be disabled in-app?
问题描述
我正在寻找一种抑制某项活动的Android Pay应用的方法. iOS具有 requestAutomaticPassPresentationSuppressionWithResponseHandler 方法,该方法完全可以实现-在应用程序处于前台时取消Apple Pay-我正在尝试在Android上实现这一目标.
I am looking for a way to suppress Android Pay app for one activity. iOS has requestAutomaticPassPresentationSuppressionWithResponseHandler method, which allows exactly this - suppressing Apple Pay while the app is in the foreground - I am trying to achieve this on Android.
I have implemented foreground dispatch. This works fine for most NFC tags - tag gets detected in the activity and then is ignored. However, when contactless payment machine is detected, Android Pay app gets triggered instead and I never get onNewIntent call in my activity.
除了实施该应用程序以执行卡仿真并忽略了这些请求(出于某些原因实际上不是一种选择),我还有其他方法可以抑制Android Pay吗? (以及其他最受欢迎的以Android Pay为主的类似付款应用)
Other than implementing the app to do card emulation and ignoring these requests, which is not really an option for a few reasons, is there anything else I could do to suppress Android Pay? (and other similar payment apps with focus on Android Pay as most popular)
推荐答案
在Android 4.4及更高版本上,您可以使用读取器模式API将设备显式切换到特定标签技术的读取器/写入器模式.这将禁用其他NFC模式(对等模式("Android Beam")和卡仿真模式).
On Android 4.4 and above, you could use the reader-mode API to explicitly switch the device into reader/writer mode for a specific tag technology. This would disable the other NFC modes (peer-to-peer mode ("Android Beam") and card emulation mode).
nfcAdapter.enableReaderMode(this, new NfcAdapter.ReaderCallback() {
public void onTagDiscovered(Tag tag) { }
}, NfcAdapter.FLAG_READER_NFC_A | NfcAdapter.FLAG_READER_SKIP_NDEF_CHECK, null);
由于您还希望忽略发现的标签,因此可以简单地丢弃(忽略)通过onTagDiscovered()
接收到的标签句柄.
Since you also want to ignore discovered tags, you could then simply drop (ignore) the tag handle received through the onTagDiscovered()
.
这篇关于可以在应用内禁用Android Pay吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!