How can I check if an app is installed from a web-page on an iPhone - TagMerge
5How can I check if an app is installed from a web-page on an iPhoneHow can I check if an app is installed from a web-page on an iPhone

How can I check if an app is installed from a web-page on an iPhone

Asked 5 months ago
232
5 answers

As far as I know you can not, from a browser, check if an app is installed or not.

But you can try redirecting the phone to the app, and if nothing happens redirect the phone to a specified page, like this:

setTimeout(function () { window.location = "https://itunes.apple.com/appdir"; }, 25);
window.location = "appname://";

If the second line of code gives a result then the first row is never executed.

Similar questions:

Source: link

175

To further the accepted answer, you sometimes need to add extra code to handle people returning to the browser after launching the app - that the setTimeout function will run whenever they do. So, I do something like this:

var now = new Date().valueOf();
setTimeout(function () {
    if (new Date().valueOf() - now > 100) return;
    window.location = "https://itunes.apple.com/appdir";
}, 25);
window.location = "appname://";

That way, if there has been a freeze in code execution (i.e., app switching), it won't run.

Source: link

28

iOS Safari has a feature that allows you to add a "smart" banner to your webpage that will link either to your app, if it is installed, or to the App Store.

You do this by adding a meta tag to the page. You can even specify a detailed app URL if you want the app to do something special when it loads.

Details are at Apple's Promoting Apps with Smart App Banners page.

The mechanism has the advantages of being easy and presenting a standardized banner. The downside is that you don't have much control over the look or location. Also, all bets are off if the page is viewed in a browser other than Safari.

Source: link

0

To do that, you must create an intent-filter on your app's main activity, to open it when a given URL is called. Like this:
<activity android:name=".MainActivity >
    <intent-filter>
        <data
            android:host="www.myurl.com"
            android:pathPrefix="/openmyapp"
            android:scheme="http" >
        </data>

        <action android:name="android.intent.action.VIEW" />

        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <category android:name="android.intent.category.VIEW" />
    </intent-filter>
</activity>
In case of
<data
    android:host="www.myurl.com"
    android:pathPrefix="/openmyapp"
    android:scheme="http" >
</data>
You must create an intent-filter on your app's main activity like this:
<intent-filter android:label="filter_react_native">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="MyCustomScheme" android:host="MyCustomHost" />
</intent-filter>
Create PHP file redirect_to_app.php which will work in case user have the app installed.
<?php
header('Location: MyCustomScheme://MyCustomHost');
Create HTML/PHP file check_redirect_to_app.php which must be shown for users which didn't install your app yet.
...
<a href="https://play.google.com/store/apps/details?id=YOUR_APP_PACKAGE_NAME">Please install the application</a>
...

<script>
    location.href = '...redirect_to_app.php';
</script>

Source: link

0

In the AndroidManifest.xml of your Android app, add an asset_statements entry:
<manifest>  <application>   …    <meta-data android:name="asset_statements" android:resource="@string/asset_statements" />   …  </application></manifest>
Then, in strings.xml, add the following asset statement, updating site with your domain. Be sure to include the escaping characters.
<string name="asset_statements">  [{    \"relation\": [\"delegate_permission/common.handle_all_urls\"],    \"target\": {      \"namespace\": \"web\",      \"site\": \"https://example.com\"    }  }]</string>
platform must be playid is the GooglePlay application ID for your Android app
{  "related_applications": [{    "platform": "play",    "id": "com.android.chrome",  }]}
Add the Windows.appUriHandler extension registration to your app's manifest file Package.appxmanifest. For example, if your website's address is example.com you would add the following entry in your app's manifest:
<Applications>  <Application Id="App" ... >      ...      <Extensions>         <uap3:Extension Category="windows.appUriHandler">          <uap3:AppUriHandler>            <uap3:Host Name="example.com" />          </uap3:AppUriHandler>        </uap3:Extension>      </Extensions>  </Application></Applications>
Then, create a JSON file (without the .json file extension) named windows-app-web-link and provide your app's package family name. Place that file either on your server root, or in the /.well-known/ directory. You can find the package family name in the Packaging section in the app manifest designer.
[{  "packageFamilyName": "MyApp_9jmtgj1pbbz6e",  "paths": [ "*" ]}]

Source: link

Recent Questions on iphone

    Programming Languages