HCE foreground support.
Allow users to configure they want to favor the foreground app for tap&pay. Change-Id: I25e1058e84f468e47fd40f43b65389c04373a3ab
This commit is contained in:
@@ -24,6 +24,7 @@ import android.nfc.NfcAdapter;
|
||||
import android.nfc.cardemulation.ApduServiceInfo;
|
||||
import android.nfc.cardemulation.CardEmulation;
|
||||
import android.provider.Settings;
|
||||
import android.provider.Settings.SettingNotFoundException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -74,6 +75,20 @@ public class PaymentBackend {
|
||||
return appInfos;
|
||||
}
|
||||
|
||||
boolean isForegroundMode() {
|
||||
try {
|
||||
return Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.NFC_PAYMENT_FOREGROUND) != 0;
|
||||
} catch (SettingNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void setForegroundMode(boolean foreground) {
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Settings.Secure.NFC_PAYMENT_FOREGROUND, foreground ? 1 : 0) ;
|
||||
}
|
||||
|
||||
ComponentName getDefaultPaymentApp() {
|
||||
String componentString = Settings.Secure.getString(mContext.getContentResolver(),
|
||||
Settings.Secure.NFC_PAYMENT_DEFAULT_COMPONENT);
|
||||
|
Reference in New Issue
Block a user