iOS App URL Scheme launch application or open app store - javascript

In iOS App, to launch an application from safari, the URL scheme is something like this, Launch App from URL
is it possible to re-direct URL to Appstore pointing to the App if the particular app is not installed in the device,
Basically what i am looking
If app is already installed then let it be launch from the URL "A"
if app is not installed let it point to app store and promot user to download app,
there are examples of how to link to app to app store, but not able to add condition in the js when to launch custom URL scheme if app is there, else launch app store.
Update :
the answer provided and in the comment take me to the page which says how to launch the app store with specific app that's secdonary requirement, initially i need to have some js code which can detect whether the device has an app specific to URL scheme if not then open the App Store app page
element

I'm not sure if you can check if a third party app is installed on your device by code. I think only when you know the url-scheme of this specific 3rd party app you can check by
BOOL canOpen = NO;
canOpen = [[UIApplication sharedApplication] canOpenURL:url];
if (canOpen) {
[[UIApplication sharedApplication] openURL:url];
} else {
[[UIApplication sharedApplication] openURL:#"itms://itunes.apple.com/us/app/mensa-essen/id742570910?ls=1&mt=8"]; }

Related

Android intent from vue application

How can I send an android intent from a vue-web-app?
For example to start an external app to scan a barcode and return the barcode number.
I have a vue web app which runs in a browser environment and I want to start a native android app to scan a barcode. How can I send an "android intent" from this vue-web-app to achieve this? Do I need a specific plugin for example?
The app you're trying to start needs to have a custom URL scheme defined in the intent filter. In that case you'll have an URI looking like this: demoapp://scan?type=128
When your Vue app redirects to an URI like this on an Android phone (with the app installed) it will pick up the intent and launch the app with corresponding activity started.

How to open saved web app using JavaScript?

I'm new to PWA (Progressive Web App) and using Angular. I have configured a service worker module as described in the Angular docs. Everything is working fine. On Android, the user is able to add the app to the home screen and it is working on offline as well. But I'm unable to find the functionality to open the saved web app by triggering an action in the browser.
Let's say https://pwa.com is a domain and I want to open saved app (on the home screen) from another domain like https://example.com or from another route on the same domain like https://pwa.com/openApp by clicking on a button. Is there any possibility to do this?
Looks like this is possible for Android: https://developers.google.com/web/fundamentals/integration/webapks
But doesn't seem like it works for iOS
https://medium.com/#firt/progressive-web-apps-on-ios-are-here-d00430dee3a7

Tell if android app is installed using javascript or jquery

I have an android app that can be accessed through a web browser too. I need to put a banner to let the user install the android application. How can i tell (if the user enters to the application through the web browser) using javascript or jquery, if the android app is already installed on his mobile phone?
All i want to do is: If the user clics the banner and the app is already installed, open the android app. Otherwise, redirect the user to the playstore to let him install the app.
Let's say your app is uploaded on both Apple AppStore and Google Play stores.
You need to:
Sniff in your webpage which OS is installed from the device accessing your page
good link to find how => here
Enable deep linking to listen for exactly same link from your mobile native app
for Android you need to register your main activity or any other activity to listen for these links
for iOS - no idea honestly, look around or find a 3rd party service
code for Google Play with deep link. And the deep link is same as your website page you want to cache/index in Google Search (or any other search engine)
sample link to index/use => http://my_website.com/results
// below snipplet need to be for Android devices only
// i.e. need to sniff and have if/else validation for Android, iOS, desktop and so on
// will call with 25 mills delay in case deep link fails, i.e. no installed app
setTimeout(function () { window.location = "https://play.google.com/details?id=com.foo.myapp"; }, 25);
// try to load the deep link URL
window.location = "http://my_website.com/results";
repeat above for iOS and desktop/Windows Mobile
Additional advantage of above is the full app indexing without the lame App Indexing excuse from Google (min sdk no more than 17, Chrome for Android availability and so forth limitations).
There is no way to detect if an app is installed using Javascript.
However you can get the behavior you describe and you don't even need any javascript:
Choose an URL for your app on a web server you own and make the banner link to it.
Set this web URL as a deep link handled by your app by specifing it in your app's manifest. It should open the main Activity.
On your web server, configure this URL to redirect to the Play Store URL of your app. Optional: if your app is also on iOS, you could detect the iOS browser and display something else.
If the app is installed it will handle the URL and open, otherwise the browser will follow the link and the redirect and the Play Store app will open to handle the Play Store URL to your app.

How to detect android application installed or not through web page, if not installed then stay there or redirect to apps store

When I check the application installed or not using custom URL with JavaScript then application jump to the application but
if app is not installed then redirect to blank page myschema://details?parameters if installed then working fine and open both link that i redirect in my code play store as well as custom URL that I configured in android apps.
Below is my code (same logic I implemeted in iOS app and it's working fine)
var now = new Date().valueOf();
setTimeout(function(){
if (new Date().valueOf() - now > 100) return;
window.location = "https://play.google.com/store/apps/details?id=my.apps.package";//play store URL.
},25);
window.location = "myschema://details?parameters";//custom url
Is there any way to jump on custom URL if not installed apps then redirect to play store URL?

launching an app with a URL

I have a web-page which checks the user agent and redirects accordingly:
Opend the appstore to download the app for first time/open the app if app is already installed
Redirects to desktop site for all other user agents
now the issue here is: if the app is deleted it throws error like error: page URI not supported.
Ss there a way to check if the user has deleted the app?
PS(can only use javascript to do this).Thanks

Categories