I have searched google every where to find a solution for 'Android App does not open through schema (default/chrome browsers)'. But I could not find a proper solution.
Below code set I added to Android Manifest.xml to link schema with browser.
<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="com.qa-soft.team" />
android:pathPrefix="/"/>
</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:scheme="com.qa-soft.team" />
</intent-filter>
but when I access ( com.qa-soft.team://OPENPDF-INDEX.pdf ) through default/chrome browser, it will be redirected to google search.
Anyhow when I access through firefox browser, it is working fine. (load the app activity)
what is the real issue for this and how can I overcome it?
Related
Since many days Em wondering to find a solution for Android Launcher Application. What we want is to make customized launcher application so we can hide some of the applications from our office devices.
What I did till now?
I used the below Code in Manifest.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
But this doesn't work at all.
add this, you must have to declare category as Home
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
Following the suggestions from How to add my browser in the default browser selection list in android?. I have specified my Intent in the manifest file:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http"/>
<data android:scheme="https"/>
</intent-filter>
I have also added the permission:
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
But still my browser is not showing in the default app options for the browser category in the settings.
Do I need to do anything else for my app to show up in the default options for browser?
Try to include the <category android:name="android.intent.category.BROWSABLE" /> in your target activity's intent-filter as developer documentation said:
If the user is viewing a web page or an e-mail and clicks on a link in the text, the Intent generated execute that link will require the BROWSABLE category, so that only activities supporting this category will be considered as possible actions.
It is required in order for the intent-filter to be accessible from a clickable link. Without it, clicking a link cannot resolve to your app.
<activity ...>
<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" />
</intent-filter>
</activity>
.
Additional Tip: (If you want to force your app to be the default browser)
Android App Links on Android 6.0 (API level 23) and higher allow an app to designate itself as the default handler of a given type of link. If the user doesn't want the app to be the default handler, they can override this behavior from their device's system settings.
To enable link handling verification for your app, set android:autoVerify="true" in intent-filter tag:
<activity ...>
<intent-filter android:autoVerify="true">
...
</intent-filter>
</activity>
You need to consider various cases that may be applicable.
Please refer the intent-filters below. Also link is provided at the end.
<activity android:name="BrowserActivity"
android:label="#string/application_name"
android:launchMode="singleTask"
android:alwaysRetainTaskState="true"
android:configChanges="orientation|keyboardHidden"
android:theme="#style/BrowserTheme"
android:windowSoftInputMode="adjustResize" >
<intent-filter>
<action android:name="android.speech.action.VOICE_SEARCH_RESULTS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<!-- For these schemes were not particular MIME type has been
supplied, we are a good candidate. -->
<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>
<!-- For these schemes where any of these particular MIME types
have been supplied, we are a good candidate. -->
<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>
<!-- We are also the main entry point of the browser. -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<!-- The maps app is a much better experience, so it's not
worth having this at all... especially for a demo!
<intent-filter android:label="Map In Browser">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/postal-address" />
</intent-filter>
-->
<intent-filter>
<action android:name="android.intent.action.WEB_SEARCH" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="" />
<data android:scheme="http" />
<data android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MEDIA_SEARCH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="#xml/searchable" />
</activity>
Look at the different types of intent-filters you might need in order to cover all possible cases.
Refer to this link - complete manifest file of froyo browser.
Consider using CATEGORY_APP_BROWSER with your main filter:
Used with ACTION_MAIN to launch the browser application. The activity should be able to browse the Internet.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.APP_BROWSER" />
</intent-filter>
You can do it with Intent-Filter by making your Activity Browsable.using below code in Android manifest File.
You can do it with Launcher Activity.
<activity android:name="BrowsableActivity">
<intent_filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent_filter>
</activity>
And you must provide scheme as http and https for links to be open with your Application.
As mentioned in documentation over developer.android.com
you need to set intent filer as below
<activity ...>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<!-- Include the host attribute if you want your app to respond
only to URLs with your app's domain. -->
<data android:scheme="http" android:host="www.example.com" />
<category android:name="android.intent.category.DEFAULT" />
<!-- The BROWSABLE category is required to get links from web pages. -->
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
You can achieve this programatically, like this:
Intent share = new Intent(android.content.Intent.ACTION_SEND);
share.setType("text/plain");
share.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
share.setPackage("your.app.package.name");
startActivity(share);
and also it will be good, if you put a check for the app existence on phone.
Happy Coding :)
I have developed an android application on which i'm using deep-link to open the application and it is working perfectly on all the other device except in Samsung mobiles and that too when i try to open it via Samsung default Messenger, instead of launching the application it is redirecting me to Google play store.
Please give me solution to find out what i have missed out.
<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:exported="true"
android:host="frr.com"
android:scheme="https" />
<data
android:exported="true"
android:host="frr.com"
android:scheme="http" />
<data
android:exported="true"
android:host="www.frr.com"
android:scheme="https" />
<data
android:exported="true"
android:host="www.frr.com"
android:scheme="http" />
</intent-filter>
And this is the link- https://frr.com/open.php
There are two ways of deep-linking into apps on Android: App Links and URI Schemes. The configuration you provide is for App Links, which many apps on Android still do not support. In order to link out of such apps you must use a URI Scheme. To ensure the widest support you should configure your app to use both App Links and a URI Scheme.
Here is an example intent-filter for linking to an app with the URI Scheme "branchtest" via URI Scheme:
<intent-filter>
<data android:scheme="branchtest"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
I grabbed this example from a Branch demo app that supports both App Links and URI Schemes, here: https://github.com/BranchMetrics/android-branch-deep-linking/blob/master/Branch-SDK-TestBed/AndroidManifest.xml
I want to implement such functionality in my simple Android app: when user visits a certain link (www.example.org let's say) in the web browser - Android OS should open my Android application if it is installed.
I tried to play with intent-filters like this:
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<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.org"
android:pathPattern="/.*"
android:scheme="http" />
<data
android:host="www.example.org"
android:pathPattern="/.*"
android:scheme="http"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
But it's not working at all in google chrome mobile browser. In firefox, when I visit that link I get such Android icon on the right side of the search bar:
When I press that icon - my app opens. But still it is not what exactly I want to achieve.
Any idea why my code above doesn't work? I tried many variations of intent-filter declarations which I found on internet but nothing seem to work. I have nexus 5 device with Android 6 installed.
I have found a solution to my problem. Whole internet is full of old examples.
Since chrome version 25, google made slight changes in app deep linking functionality. More info: https://developer.chrome.com/multidevice/android/intents
So my working code looks like this:
Intent filter in Android side:
<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="launcher"
android:path="/"
android:scheme="test" />
</intent-filter>
Web page html:
Launch app
Try it like this, removing the path pattern:
<intent-filter>
<data android:scheme="http" android:host="twitter.com"/>
<action android:name="android.intent.action.VIEW" />
</intent-filter>
More info:
Launch custom android application from android browser
<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.org"
android:scheme="http" />
</intent-filter>
I am trying to open an Android app from a browser. I have read several StackOverflow threads describing a solution to the problem and this is what I have so far:
AndroidManifest.xml
<activity
android:name="com.webviewtestapp.MainActivity"
android:label="#string/app_name"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.LAUNCHER" />
<data android:scheme="Testapp" android:host="launch"/>
</intent-filter>
</activity>
And this is the html <a href="Testapp://launch"> open testapp </a
I am using the Firefox browser in Chrome and clicking the link gives a message: Couldn't find an application to open this link
How do I fix this ?
Change:
<action android:name="android.intent.action.MAIN" />
to:
<action android:name="android.intent.action.VIEW" />