NFC intent on Android for Work - android

I've created a very basic app that has an intent for external NDEF type as shown below.
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="vnd.android.nfc"
android:host="ext"
android:pathPrefix="/com.example:externalType"/>
</intent-filter>
The activity the above is nested in is the main activity for the app and is just a vanilla blank activity.
All works fine on the standard user side however if I side load the app on to the Work Profile the intent never reaches the app and the "New tag collected" screen is shown.
The Android documentation states that the Profile administrator can control which intents are sent across from the user to the work profile however I can find no such settings within the BlackBerry Enterprise Server 12 (our MDM) console or the Android for Work console.
http://developer.android.com/training/enterprise/app-compatibility.html#prevent_failed_intents

Related

Android deep link intent doesn't work on some devices

I have an app that listens for a deeplinks starting with example:// The app can be launched by scanning a QR code containing a deeplink.
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "example://” -->
<data android:scheme="example"/>
</intent-filter>
I am using the code above. It works exactly as expected on Samsung hardware. My other test device is a Google Pixel 5a. When using the google default camera with my app installed, The camera sees a deeplink starting with example:// my app is not part of the "open with" list that appears.
Any ideas what may be causing this?
It looks as though this is a bug specific to the Pixel camera app. The app is treating all example:// links as though the destination is a web browser, even though http:// or https:// is not included

Instant Apps with NFC

I'm trying to get an instant app to be opened via NFC.
I have something like the below in my AndroidManifest.xml
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:scheme="http" />
<data android:host="example-refresh.herokuapp.com" />
</intent-filter>
When going to https://example-refresh.herokuapp.com (example link obviously) from a link click the instant app loads correctly. When opening that link from an nfc tag the browser just loads. I've tried also having the nfc open an AAR (https://developer.android.com/guide/topics/connectivity/nfc/nfc.html#aar) this results in the play store link opening when the app isn't installed and the app correctly opening from the nfc when it is installed. If I have something else on the nfc so it shows the disambigious options then I can select instant app for the browser option, but I would like for it to default to instant app.
Is there something I'm missing to get an nfc tag to load an instant app? I've also tried using branch, but with no luck.
Instant apps have a very limited set of allowed permissions and NFC is not in that set. Thus any NFC related intent will not work. Besides, whatever you define on your manifest only works when your app is installed. Which obviously is not the case for instant apps. Google does index the android.intent.action.VIEW intents when you upload your APK to Play Store, so they can make instant app works.
So when you scan an NFC, it is an android.nfc.action.NDEF_DISCOVERED intent, and therefore your app won't be launched
However, you still can make it work. Instead of using the link you would normally use to launch your instant app, you should write the link to your instant app on the Play Store to your NFC tag.
https://play.google.com/store/apps/details?id=<package_name>&launch=true
Check https://developer.android.com/distribute/marketing-tools/linking-to-google-play#Instant

Android intent filter scheme doesn't seem to work

I'm trying to build a simple Android app that sends a Youtube URL to a particular media server. On the Android side, it needs to be activated by the user pressing the share button on a video inside the Youtube app (or browser). However, I'm having extreme difficulty working out how intent filters work in this case.
The following code, for example, makes my app show up in the apps list when I share from youtube (or almost anything else for that matter).
<activity
android:name=".DisplayMessageActivity"
android:label="#string/title_activity_display_message"
android:parentActivityName=".MyActivity" >
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.myfirstapp.MyActivity" />
</activity>
However, when I replace the element with anything containing a scheme, for example:
<data android:mimeType="text/plain" android:scheme="https" />
The app no longer appears in the sharing list. I've tried every combination, and nothing seems to work. Any suggestions (general about intent filters, or more specific to Youtube)?
EDIT:
After investigation using Intent Interceptor, I've discovered that links (e.g. from Youtube or the browser) are sent with the DATA field sent to NULL. Other types of intent (for example, a file) appear to have this set to the URL of the file. Presuming that the filter scheme/host/path act on the DATA section of the intent, there is no data there to filter, so links can't be filtered in this regard. Can anyone confirm or clarify this?

What is the intent that the stock Samsung Galaxy S2 gallery app fires when "Send" is clicked?

I currently have the following problem:
I want to receive images with my app that are sent from other apps. So I have registered the following intent-filters:
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
It worked fine for my gallery app (CM9) and a bunch of third party gallery apps i have installed via Play Store (Quick Pic etc...).
But then the client complained that his gallery app (stock Galaxy S2) doesn't show my app in the list when clicks the "Send" button. Interesting side-note: There is also a "Send via" button, which shows up the apps normally (and thus seems to be the SEND_MULTIPLE intent).
The "Send" button shows the following apps:
Bluetooth
Email
Google Mail
Messaging
Wi-Fi Direcct
That's it.
So my question is: Which Intent could this possible be that I have to register for? Can't find any intent for sending files/multiple files other then SEND and SEND_MUTLIPLE :(
Any ideas?
on the Galaxy S2 the ShareIntent appears if the user press menu. That 'Share to' menu on the screen is hard coded by Samsung and you can't override it.

Android Intent filter not working for all devices (action SEND and SEND_MULTIPLE)

I have an android containing an activity that can receive pictures sent to it by the android share menu. The activity has this configuration in the manifest file:
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" />
<data android:mimeType="image/*" />
</intent-filter>
I am using the mimeType filter to allow only images to be sent to the activity.
Apparently, this is not working on all devices. I have tested it on the Nexus S and Galaxy S/S2 and it worked great, but I've got complaints from some users (especially xperia) saying the app it not showing in the Share menu when it's opened on a photo from the gallery.
The app is using SDK 2.1 sdk 7.
There is no rule that says that an activity have a "share" menu that supports any particular Intent filter.
That being said, I would add:
<category android:name="android.intent.category.DEFAULT" />
to your filter.

Categories

Resources