Issue
I have tried every suggestion out here with no luck. I simply want my app to receive the intent if a user clicks on a text file from a file explorer like the Samsung 'My Files' app. It just does not show up on the list of available apps.
My activity is specified like this at present:
<activity
android:name=".ImportActivity"
android:label="@string/title_activity_import"
android:parentActivityName=".MainActivity"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter android:label="import">
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.PICK" />
<action android:name="android.intent.action.PICK_ACTIVITY" />
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
<data android:scheme="file" android:host="*" android:pathPattern=".*\\.txt" />
<data android:scheme="content" android:host="*" android:pathPattern=".*\\.txt" />
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.hubbardsoftware.racetac.MainActivity" />
</activity>
I put a 'test.txt' file in my download folder that just has a line of text in it. Navigate to it with 'My Files', tap it, and get an option to open with 'HTML Viewer', 'Chrome', and 'Hancom Office 2014'. My app is called 'RaceTac' and it just doesn't show up. The app is working fine otherwise. I have tried simpler versions of the filter too. It's staring me in the face I know it.
Thanks, Dave
Solution
Remove the host and pathPattern, from the documentation it's not needed
<activity
android:name=".ImportActivity"
android:label="@string/title_activity_import"
android:parentActivityName=".MainActivity"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter android:label="import">
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.PICK" />
<action android:name="android.intent.action.PICK_ACTIVITY" />
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
<data android:scheme="file" />
<data android:scheme="content" />
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.hubbardsoftware.racetac.MainActivity" />
</activity>
developer.android.com/guide/components/intents-filters.htmll
Answered By - Michael B.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.