I am writing the application to open HTML files. In some devices (like Galaxy player,nexus one) when i try to open html file from Email client ,my application is not showing in
"open with"
open with " dialog ,but if i open the same HTML file from Gmail client my app is showing in
"open with "
open with" dialog . In other devices(like Google nexus ,S2 etc), i am able to open the HTML file through my application from Email client, Email client .is this device specific issue?
In some devices Email client is not opening the app with mime type as text/html.so i changed like follows.
<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:mimeType="text/html"/>
<data android:mimeType="text/plain"/>
</intent-filter>
Then email app is able to show my application in the list.but it will show when we tring to opne HTML/Text files.
If your app opens .HTML files, the intent filter should look something like this:
<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:pathPattern=".*\\.html" />
<data android:mimeType="*/*" />
<data android:scheme="file" />
<data android:host="*" />
</intent-filter>
Related
I'm making a custom application and I need to enable it to use it as a file picker (like Drive, and Fotografias, Solid Explorer in the attached screenshot)
I want to open one of my app activities in order to use it as a custom signature pad
My plan is to allow the user to sign and that whould be returned to the file input of the caller application
Currently I have a deeplink that allows me to open the signature activity, the signature is saved in the filesystem of the phone, and after that the user has to use the file explorer to select the signature
Use Intent-filter for this purpose:
Read here: https://developer.android.com/guide/components/intents-filters
<activity android:name="com.yourapp.MainActivity">
<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=".*\\.your_file_extension" />
<data android:host="*" />
</intent-filter>
</activity>
I have a activity that apply intent filter to open deeplink, this is my intent filter :
<intent-filter android:autoVerify="true">
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.example.com"
android:pathPattern="/..*"
android:scheme="https" />
</intent-filter>
my problem is, when user open a link i.e "www.example.com/somepage" from messaging apps e.g Hangout,Whatsapp, Android app chooser doesn't display may apps in its list, it just show all browser app in the options. But when user put "https://www.example.com/somepage" in a message then it works, Android show my app in its App chooser to open the link.
It also doesn't work When I try to remove android:scheme="https" from my intent filter.
is there anyone has same problem and have a solution?
Any help really appreciated.
This is expected behavior.
What the following snippet does is register your app as a handler for the URL scheme https://
<data
android:host="www.example.com"
android:pathPattern="/..*"
android:scheme="https" />
This means your app will be offered as an option for any link beginning with https:// and containing www.example.com. The string www.example.com/somepage doesn't qualify, as it is missing the https:// part.
You could try adding a second filter for http:// links. I'm not sure if Android automatically infers that as the scheme for web links without a scheme specified, so it's possible this could resolve the issue.
<intent-filter android:autoVerify="true">
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.example.com"
android:pathPattern="/..*"
android:scheme="https" />
<data
android:host="www.example.com"
android:pathPattern="/..*"
android:scheme="http" />
</intent-filter>
When user type the url to my .someExt file in his web browser (on Android Phone), the message appears:
This content is unsupported content. Do you really want to download?
Instead, I would like to associate the .someExt (my custom file extension) with my Android Application (that the user has downloaded previously) so when user type the url to .someExt in browser my Application will open the file.
How to achieve it? I guess it has to be done with manifest and some "handle" method in my Activity.
Based on: Associate App with file extension - Intent filter Not working?
I have used:
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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:mimeType="application/someExt" />
</intent-filter>
<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:scheme="file" />
<data android:scheme="smb" />
<data android:scheme="content" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.someExt" />
</intent-filter>
</activity>
Now, when user type the url to my .someExt the file is being downloaded and I can open it when downloading is done (so my Application will run it). But I don't want all those additional clicks - I want it to be:
User click the link to .someExt on the website.
The .someExt opens in my Android Application.
And not the:
User click the link to .someExt on the website.
The file starts to download.
User open "downloads" and click on downloaded file.
The .someExt opens in my Android Application.
I don't think you can realize this feature in Android with different kind of browsers. The URL user type is handled by the browser most of the time. How to deal with the scheme is decided by the behaviors of the browser. If your scheme is http, the browser will try to open with it own and handle by itself.
Currently, most browsers add support for market scheme. If the URI's scheme is market, it will jump to Google Play or other markets.
But is can be done from other app with Intent.
Declare your activity like following to receive the ACTION_VIEW action.
<activity
android:name=".MainActivity2Activity"
android:label="#string/title_activity_main_activity2">
<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:host="com.example.myapp"
android:mimeType="*/*"
android:pathPattern=".*\\.someExt"
android:scheme="http" />
</intent-filter>
</activity>
From other apps, you could do like this.
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("http://com.example.myapp/test.someExt"), "*/*");
intent.setPackage("com.example.myapplication");
startActivity(intent);
How to make redirect my app without dialog (Choose Option) when user open custom url like this
https://signin.ebay.com/ws/eBayISAPI.dll?ThirdPartyAuthSuccessFailure&isAuthSeccesfull=true&ebaytkn=&tknexp=1233-4503223
I've tried to using intent filter in my android manifest like this
<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"
android:host="signin.ebay.com" android:pathPattern="/ws/eBayISAPI.dll?/ThirdPartyAuthSuccessFailure&isAuthSuccessful=true*"/>
<data
android:scheme="http"
android:host="signin.ebay.com" android:pathPattern="/ws/eBayISAPI.dll?/ThirdPartyAuthSuccessFailure&isAuthSuccessful=true*"/>
</intent-filter>
but its not working , but when I've tried code like this
<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"
android:host="signin.ebay.com" />
<data
android:scheme="http"
android:host="signin.ebay.com"/>
</intent-filter>
its working but it show dialog ChooseOption sometimes I open browser with url https://signin.ebay.com or http://signin.ebay.com
How to make when user open url this
https://signin.ebay.com/ws/eBayISAPI.dll?ThirdPartyAuthSuccessFailure&isAuthSeccesfull=true&ebaytkn=&tknexp=1233-4503223
they will redirect to my app WITHOUT dialog box ChooseOption , my tknexp is not static remember , thanks
It is asking to choose option because you have given android:scheme="https". Because of this Android will look for applications , which supports android:scheme="https" and will show user if there are multiple application taking care of thie scheme.
To Avoid it change the android:scheme="https" to android:scheme="<your own scheme>" which is handled by only you app. This will redirect directly to you application.
Now in your activities onCreate method you will receive the URL with instead of https://. But now you have total control on url , you can change it to https://.
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.xyz" />
</intent-filter>
When I click on somefile.xyz it opens an Intent chooser which contains app's in which I have declaired above intent-filter(.xyz custom file type).But this works when file is in sdcard and I click on it.
How can i make this work for a file as an attachment because the problem is android is not allowing me to download unknown file types from email.