Skip to content

Commit

Permalink
Add support for mailto: URI on NFC tag (#7804)
Browse files Browse the repository at this point in the history
  • Loading branch information
Silas217209 authored May 3, 2024
1 parent 2240586 commit 6be3dbd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions app/common/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@
<data android:scheme="mailto" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<data android:scheme="mailto" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="*/*" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import android.content.IntentSender.SendIntentException;
import android.content.pm.ActivityInfo;
import android.net.Uri;
import android.nfc.NfcAdapter;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
Expand Down Expand Up @@ -503,9 +504,9 @@ private boolean initFromIntent(final Intent intent) {
boolean startedByExternalIntent = false;
final String action = intent.getAction();

if (Intent.ACTION_VIEW.equals(action) || Intent.ACTION_SENDTO.equals(action)) {
if (Intent.ACTION_VIEW.equals(action) || Intent.ACTION_SENDTO.equals(action) || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) {
/*
* Someone has clicked a mailto: link. The address is in the URI.
* Someone has clicked a mailto: link, or scanned an NFC tag. The address is in the URI.
*/
if (intent.getData() != null) {
Uri uri = intent.getData();
Expand Down

0 comments on commit 6be3dbd

Please sign in to comment.