Android intent from vue application - javascript

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.

Related

How can I link Firebase auth Android app and web app?

I have two projects a web app and an Android app and I want to link them together. I have Firebase auth set up on the Android app (user app) and I want the admin web application to link the auth account as 2 way (admin and user). Is that possible? If it is, can you explain how?
Is that possible?
For sure it's possible. This can be simply done inside the Firebase console. Once you have successfully created your project, then you'll be able to add as many apps as you need. Since you have a web and an Android app, you should go to "Project settings" and hit the blue Add app button. The first time you should create the web app and the second time, the Android app. How? Simply follow the instructions that are provided. There are only 2 steps in the case of a web app, and four in the case of an Android app.

Is it possible to open a facebook group link in facebook app from android webview application build by android studio

I want to know is it possible to open a facebook group link in facebook app from android webview application build by android studio.
is there any html and JavaScript for that.
With webview in android studio, you can only open links inside your app and not outside.
In your case, you want a facebook group link to be opened in the facebook app which may not be possible using Webview.
That's why you need to use WebViewClient. You need to override shouldOverrideUrlLoading method and start an intetn with the package "com.facebook"
Check this answer: https://stackoverflow.com/a/50293855/12802591
You may need to test if the user already had facebook app installed then open the group link there, if not it will open the group link inside the web view.
Another useful link :
https://stackoverflow.com/a/54589702/12802591
Let me know if it works !

Registering a Custom href Protocol on Windows Mobile in JavaScript

I am developing a web-based mobile application, My application has a button that takes the user to the dialer where a USSD code is ready for the user to dial. This works fine on Android Devices and iOS devices.
Trigger USSD
On Windows 10 Mobile that link triggers the People App or the Skype App. If this was a native app I know I could register a URI protocol to trigger the dialer. Is there a workaround in JavaScript I can use to target the dialer (Or Phone App) specifically such as registering a custom href protocol maybe.
For my understanding, like you said, the app itself is responsible for registering custom URI or catch the intent of existing URI, even from the browser. On Android, the user can choose from all the application that catch the intent what application he wants to use.
I think that the answer should be what kind of protocol the Phone app uses, then use this protocol in order to 'target' the dialer.
It seems there is no protocol of Phone app being exposed, but you can use the PhoneCallManager.showPhoneCallUI method to launch the built-in phone call UI with the specified phone number and display name.
Windows.ApplicationModel.Calls.PhoneCallManager.showPhoneCallUI(phoneNumber, displayName);

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.

iOS App URL Scheme launch application or open app store

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"]; }

Categories