I have an application that launches an activity when an nfc tag (ndef) is detected.
I tested and is working properly. This is simple, in manifest I add this to my activity:
<uses-permission android:name="android.permission.NFC" />
<uses-feature
android:name="android.hardware.nfc"
android:required="true" />
<activity
android:name=".features.dashboard.view.activity.DashboardActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/com.SOME_MYME_TYPE" />
</intent-filter>
</activity>
It is obvious that I have used a mimetype with which I record the tags. And i managed "onNewIntent" to process data.
The problem begins when Install the application in a work profile. App starts normally, but when i try to read NFC and launch my activity, the application do nothing...
I have seen the log's and I've only found this error:
ActivityNotFoundException: No Activity found to handle Intent E/NfcService: activity not foundandroid.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.nfc.action.NDEF_DISCOVERED typ=application/com.example_package (has extras) }
I'm confused about why in my personal space is working and why not doing in work profile.
In the personal space the application is launched whenever it detects the TAG, in the work profile it only reacts if the activity is in the foreground and that it is defined with the intent-filter to detect the NDEF. That is, if it is in another activity it gives me the error that it cannot find the activity associated with the intent-filter
I've tested with this: BasicManagedProfile
I'm searching some information but I can't find the solution.
If anyone can help me i would be very grateful.
Thanks.