@Implements(value=android.nfc.NfcAdapter.class) public class ShadowNfcAdapter extends java.lang.Object
Constructor and Description |
---|
ShadowNfcAdapter() |
Modifier and Type | Method and Description |
---|---|
protected void |
disableForegroundDispatch(android.app.Activity activity) |
protected void |
enableForegroundDispatch(android.app.Activity activity,
android.app.PendingIntent intent,
android.content.IntentFilter[] filters,
java.lang.String[][] techLists) |
android.app.Activity |
getDisabledActivity() |
android.app.Activity |
getEnabledActivity() |
android.content.IntentFilter[] |
getFilters() |
android.app.PendingIntent |
getIntent() |
android.nfc.NdefMessage |
getNdefPushMessage()
Returns last set NDEF message, or throws
IllegalStateException if it was never set. |
android.nfc.NfcAdapter.CreateNdefMessageCallback |
getNdefPushMessageCallback()
Returns last registered callback, or
null if none was set. |
protected static android.nfc.NfcAdapter |
getNfcAdapter(android.content.Context context) |
android.nfc.NfcAdapter.OnNdefPushCompleteCallback |
getOnNdefPushCompleteCallback() |
java.lang.String[][] |
getTechLists() |
protected boolean |
isEnabled() |
static void |
reset() |
void |
setEnabled(boolean enabled) |
protected void |
setNdefPushMessage(android.nfc.NdefMessage message,
android.app.Activity activity,
android.app.Activity... activities)
Mocks setting NDEF push message so that it could be verified in the test.
|
protected void |
setNdefPushMessageCallback(android.nfc.NfcAdapter.CreateNdefMessageCallback callback,
android.app.Activity activity,
android.app.Activity... activities) |
static void |
setNfcHardwareExists(boolean hardwareExists)
Modifies behavior of
getNfcAdapter(Context) to return null , to simulate absence of NFC hardware. |
protected void |
setOnNdefPushCompleteCallback(android.nfc.NfcAdapter.OnNdefPushCompleteCallback callback,
android.app.Activity activity,
android.app.Activity... activities)
Sets callback that should be used on successful Android Beam (TM).
|
@Implementation protected static android.nfc.NfcAdapter getNfcAdapter(android.content.Context context)
@Implementation protected void enableForegroundDispatch(android.app.Activity activity, android.app.PendingIntent intent, android.content.IntentFilter[] filters, java.lang.String[][] techLists)
@Implementation protected void disableForegroundDispatch(android.app.Activity activity)
@Implementation protected void setNdefPushMessage(android.nfc.NdefMessage message, android.app.Activity activity, android.app.Activity... activities)
Mocks setting NDEF push message so that it could be verified in the test. Use getNdefPushMessage()
to verify that message was set.
@Implementation protected void setNdefPushMessageCallback(android.nfc.NfcAdapter.CreateNdefMessageCallback callback, android.app.Activity activity, android.app.Activity... activities)
@Implementation protected void setOnNdefPushCompleteCallback(android.nfc.NfcAdapter.OnNdefPushCompleteCallback callback, android.app.Activity activity, android.app.Activity... activities)
Sets callback that should be used on successful Android Beam (TM).
The last registered callback is recalled and can be fetched using getOnNdefPushCompleteCallback()
.
@Implementation protected boolean isEnabled()
public static void setNfcHardwareExists(boolean hardwareExists)
Modifies behavior of getNfcAdapter(Context)
to return null
, to simulate absence of NFC hardware.
public void setEnabled(boolean enabled)
public android.app.Activity getEnabledActivity()
public android.app.PendingIntent getIntent()
public android.content.IntentFilter[] getFilters()
public java.lang.String[][] getTechLists()
public android.app.Activity getDisabledActivity()
public android.nfc.NfcAdapter.CreateNdefMessageCallback getNdefPushMessageCallback()
Returns last registered callback, or null
if none was set.
public android.nfc.NfcAdapter.OnNdefPushCompleteCallback getOnNdefPushCompleteCallback()
public android.nfc.NdefMessage getNdefPushMessage()
Returns last set NDEF message, or throws IllegalStateException
if it was never set.
@Resetter public static void reset()