How to launch app on click of url in android - android

Launch app when click on url if app installed on device. if app not installed on device, open playstore.
<activity android:name=".ui.NewsCardActivity">
<intent-filter>
<data android:scheme="app" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>

You have to deep link your app, add following lines in activity (Manifiest.xml) which you want to launch
<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="screen" android:scheme="appname"/>
</intent-filter>
in browser when ever you click appname://screen your app activity will be launched,
replace appname and screen as per your requirement
Note if you type this url in browser it will search in google ,for this to work you have to write link in html page
Some text
If not working the add android:exported="true" in activity
<activity
android:name=".activity.MainActivity"
android:exported="true">

Related

Deeplink does not open the app from Gmail

We are trying to implement deepLink from a Gmail in our app. I add following code to my Manifest file :
<activity
android:name="io.fetchcar.archapp.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="#string/filter_view_fetch">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="fetch" />
</intent-filter>
</activity>
In the Gmail we have following button with html code :
Fetch A Car Now
But when we click on the button from Gmail, it does not open the app.
The thing is if we open it as a web page in the browser and click on Fetch A Car Now button, it opens our app as expected.
Is it any limitation to open our app with Deeplink from Gmail ?

Browser can't open an app from a browser using deeplink

I'm trying to implement deeplinks in my, so users will be able to open the application from a browser. So, I've added deeplinks in my application in a Manifest.xml. And this code is working from adb, but when I'm trying to open this link in browser, the application does not opens. What can cause this error? I can even can't see an Intent in my code
<activity
android:name=".ui.main.MainActivity"
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<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:scheme="http"
android:host="example.com"
android:pathPrefix="/"/>
</intent-filter>
</activity>
Use Firebase deep link ( Hope Help-full )
https://firebase.google.com/docs/dynamic-links

Android intent filter not working to launch activity from browser

I've read a tutorial on how to launch an app from a link on the browser. I've created an activity 'TestLaunch'.
<activity
android:name=".TestMe"
android:label="Test">
<intent-filter>
<data android:scheme="testme.com" />
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
Then I connected my android phone and clicked 'debug' on Eclipse. The app launched as usual. I openned the browser and typed 'testme.com'. The activity was not started as expected. Is this because the app is not fully installed on the phone or because I am understanding wrongly how the intent filter works?
try this:
<activity
android:name=".TestMe"
android:label="Test">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:host="www.testme.com" android:scheme="http"></data>
</intent-filter>
</activity>

Launch Android application from browser

I have a little problem.
I have an Android Activity, and I want to run it from one link on the browser.
This is what how I have declared my Activity on the Manifest file:
<activity android:name=".Wul4"
android:windowSoftInputMode="adjustPan"
android:configChanges="keyboardHidden|orientation"
android:launchMode="singleInstance"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="wul4" android:host="com.wul4.wul4"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
On the webApp, the link to launch the application is the following one:
wul4://com.wul4.wul4?codOperacion="+respuestaActual.idOperacion
The point is that It is working from the following browsers: "Opera" and "Google Chrome", but it is not working for the rest..........(for instance, it is not working on the default browser of the phone).
Anyone knows why???
Thanks a lot!
Try this one, using HTTP instead of your own schema:
<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="com.wul4.wul4"
android:scheme="http:" />
</intent-filter>
When a link with this domain is clicked in an Android device, the user is presented with a dialog to choose between your App (if installed) or the Browser.

Could not launch application by calling a URL from Android Browser

There are many answers in stackoverflow showing how to lauch app from a web browser ,but I am not sure what went wrong with my code, that never seems to be doing the intended.
I am trying to launch my app by a URL from any other app like web browser,initially
my manifest file looks like this
<activity android:name=".Main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="http" android:host="ebay.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
And When I typed http://ebay.com in the browser that never started my app.Obviously,how does the browser know about my app?,then i tried the other way around and added another Activity called MyActivity and altered the manifest file as
<activity android:name=".Main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MyActivity">
<intent-filter>
<data android:scheme="http" android:host="ebay.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
and tried in my Main Activity
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("http://mycityway.com")));
Thus producing the intended result.I can also start another application Activity using this method.
But most of the answers here says that the later is possible.What is the mistake i am doing,I couldn't launch my app from browser.Please guide me.
And When I typed http://ebay.com in the browser that never started my
app.
It gets started when a matching link is clicked not when you type the url in the browser.
Try it by sending yourself an email containing http://ebay.com and click the link in the email application.

Categories

Resources