I'm programming a download manager application in android .
I create this Intent-Filter in Manifest :
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:scheme="http" />
<data android:scheme="ftp" />
<data android:host="*" />
Google Chrome define my app as a download manager successfully but Mozila Firefox not show my App in Intent dialog by clicking each link.
Please help me to fix this
I found my solution .
Put here for use anyone :
Add this Lines in you manifest :
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:mimeType="*/*" />
</intent-filter>
Related
I would like to make an activity be an option to open .json files type. For example, when I click on a .json file in my explorer, I want it to be opened (or to have an option to open it) in this activity. To achieve this, I have tried to add a pathPattern, a scheme and a host to my activity in the manifest. No success. The explorer says "No application to open this file." After searching on StackOverflow, I tried to add mimeType. Still no success. I've tried over 20 different answers from existing StackOverflow questions, without any success. Here's some of the answers I've tried: here, here, here.
Here's my activity:
<activity
android:name=".JsonActivity"
android:label="Json">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:scheme="content" />
<data android:scheme="file" />
<data android:host="*" />
<data android:pathPattern=".*\\.json" />
</intent-filter>
</activity>
What am I doing wrong? I made sure I added the WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE permissions and also the category BROWSABLE and the action VIEW.
You need multiple intent filters to address different situation you want to handle.
Example 1, handle http requests without mimetypes:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
<data android:host="*" />
<data android:pathPattern=".*\\.json" />
</intent-filter>
Handle with mimetypes, where the suffix is irrelevant:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
<data android:host="*" />
<data android:mimeType="application/json" />
</intent-filter>
Handle intent from a file browser app:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />`enter code here`
<data android:host="*" />
<data android:pathPattern=".*\\.json" />
</intent-filter>
iam trying to open my app from a link
and i succeed in it and i can open it from the link but if iam on facebook app .. its opening it with its webview so i cant open my app by its link from facebook and thats what is in my manifist
<intent-filter>
<data
android:host="example.com"
android:pathPrefix="/users"
android:scheme="http" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
thanks
Try removing this line
<category android:name="android.intent.category.BROWSABLE" />
This may fix the issue:
<data android:pathPattern="/.*" />
So the intent filter looks like:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="example.com" />
<data android:scheme="https" />
<data android:pathPattern="/.*" />
</intent-filter>
if you register your intent for http://myexample.com and you click in http://myexample.com/blah it will not work.
I'm trying to get my app to react to a .backup file in drive.
I defined my Intent filter as follow
<intent-filter android:label="#string/restoreAppBackup">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="*" />
<data android:pathPattern=".*\\.backup" />
</intent-filter>
<intent-filter android:label="#string/restoreAppBackup">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.backup"
android:scheme="file" />
</intent-filter>
This works fine once the drive file is downloaded locally, but if I try to open it from the Drive app it doesn't react.
If I remove the scheme filter it starts to react to everything event when it doesn't match the patch pattern...
Any ideas ?
Ive made an web browser, when I click on a link from gmail for example then it asks how I want to open that link-what browser I want to use (chrome/firefox etc). How do I make it so it asks if it wants to open it with my browser?
Thanks in advance.
Add the appropriate <intent-filter> elements to your activity, and support them properly.
For example, here are relevant <intent-filter> elements used by the AOSP Browser app:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:scheme="about" />
<data android:scheme="javascript" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:scheme="inline" />
<data android:mimeType="text/html"/>
<data android:mimeType="text/plain"/>
<data android:mimeType="application/xhtml+xml"/>
<data android:mimeType="application/vnd.wap.xhtml+xml"/>
</intent-filter>
I have a android application to preview .dst file type,i am able launch the app by clicking on file from the file explorer i did it by following code
<intent-filter >
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="file" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.DST" />
<data android:host="*" />
</intent-filter>
now i need to launch the app from the default gmail app,i think i need to change the
android:scheme="file"
tag ,please help me with the proper scheme for gmail application..
update the manifest as below
<intent-filter >
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="*" />
<data android:mimeType="application/octet-stream"
/>
<data android:pathPattern=".*\\.DST" />
</intent-filter>