Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open android application from a webpage?

can I call my app from HTML?

for example:I can call webpage with this code correctly from my app.

android code:

  startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(
                                    "myDomain.com")));

and after doing something in my site, I want to open my android app again.

I find this code,

<a href="market://details?id=info.androidhive.slidingmenu">

but it's just call Market to find and install the app!

like image 448
user1794863 Avatar asked Jul 14 '15 10:07

user1794863


People also ask

Can I open Android app from URL?

You achieve this by Deep linking in your app. First of all you need to add intent filters for incoming links. Specify the ACTION_VIEW intent action so that the intent filter can be reached from Google Search. Add one or more tags, each of which represents a URI format that resolves to the activity.

How do I open a mobile app on my website?

Adding Javascript to Your Website to Open Your App You merely need to add some Javascript to your website that will auto trigger your app open. The function below, triggerAppOpen, will attempt to open your app's URI scheme once you replace your_uri_scheme with the one you added in the manifest above.


2 Answers

You might have a look at this: https://developer.android.com/training/app-indexing/deep-linking.html

<activity
android:name="com.example.android.GizmosActivity"
android:label="@string/title_gizmos" >
<intent-filter android:label="@string/filter_title_viewgizmos">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <!-- Accepts URIs that begin with "http://www.example.com/gizmos” -->
    <data android:scheme="http"
          android:host="www.example.com"
          android:pathPrefix="/gizmos" />
    <!-- note that the leading "/" is required for pathPrefix-->
    <!-- Accepts URIs that begin with "example://gizmos”
    <data android:scheme="example"
          android:host="gizmos" />
    -->
</intent-filter>

So your app will be started by this link:

<a href="example://gizmos">
like image 148
Rickyy Avatar answered Nov 01 '22 13:11

Rickyy


for iOS you can set URLSchemes that will launch the app if typed on the browser: that is for example if your app called market

market:// will launch the app

to add the URLScheme do it in the info tab : enter image description here

you can handle the url options by implementing application:willFinishLaunchingWithOptions: and application:didFinishLaunchingWithOptions: methods.

like image 1
iShaalan Avatar answered Nov 01 '22 12:11

iShaalan