mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-23 17:22:16 -05:00
Temporarily fix devices without nfc
This commit is contained in:
parent
baac30508d
commit
555b0bf757
@ -476,6 +476,9 @@ public abstract class BaseNfcActivity extends BaseActivity {
|
|||||||
*/
|
*/
|
||||||
public void enableNfcForegroundDispatch() {
|
public void enableNfcForegroundDispatch() {
|
||||||
mNfcAdapter = NfcAdapter.getDefaultAdapter(this);
|
mNfcAdapter = NfcAdapter.getDefaultAdapter(this);
|
||||||
|
if (mNfcAdapter == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Intent nfcI = new Intent(this, getClass())
|
Intent nfcI = new Intent(this, getClass())
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
PendingIntent nfcPendingIntent = PendingIntent.getActivity(this, 0, nfcI, PendingIntent.FLAG_CANCEL_CURRENT);
|
PendingIntent nfcPendingIntent = PendingIntent.getActivity(this, 0, nfcI, PendingIntent.FLAG_CANCEL_CURRENT);
|
||||||
@ -497,6 +500,9 @@ public abstract class BaseNfcActivity extends BaseActivity {
|
|||||||
* Disable foreground dispatch in onPause!
|
* Disable foreground dispatch in onPause!
|
||||||
*/
|
*/
|
||||||
public void disableNfcForegroundDispatch() {
|
public void disableNfcForegroundDispatch() {
|
||||||
|
if (mNfcAdapter == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
mNfcAdapter.disableForegroundDispatch(this);
|
mNfcAdapter.disableForegroundDispatch(this);
|
||||||
Log.d(Constants.TAG, "NfcForegroundDispatch has been disabled!");
|
Log.d(Constants.TAG, "NfcForegroundDispatch has been disabled!");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user