How to call an app mobile via web view? - android

is there a solution to call a mobile app via a link in a web page(my web page is a web view in a mobile app). For example, I want to call facebook app when tap on a link.

You need to create an <intent-filter>. See Launch custom android application from android browser.
For the simplest case, you need to add something like this to your AndroidManifest.xml:
<intent-filter>
<data android:scheme="http" android:host="your-url-.com"/>
<action android:name="android.intent.action.VIEW" />
</intent-filter>

You have to add an Intent filter in Manifest file like this -
<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="www.tamrakar.in"
android:path="/test"
android:scheme="http" />
</intent-filter>
Hope this helps.

Related

How to register a react native mobile app with the default existing URL Schema tel for telephone custom dialer

Our teams goal is to have a customer dialer app on mobile phones b/c we want to mask the phone number for our users. They dont want their personal real numbers on caller ID. We have a phone service to do this behind the scenes (Twilio), but need to have our native app register as responding to the "tel" URL Schema and hooked into the React Native Deep LInk APis.
https://reactnative.dev/docs/linking#built-in-url-schemes
We have setup and followed the normal tutorials for custom URL schemas, like "myawesomeapp:/phone/+12223334444"
and we can get that to open.
We want the app to register as a main dialer app though, when we do not control to setup this custom url. So anywhere there is a link for +12223334444 we want the OS to offer our app vs the main phone app when user clicks on this link.
Any tutorial on this? How to do this in Android and iOS using React Native. We started with expo default react native project, but ejected it and have full control of native settings. Thanks!
This tutorial was userful or the custom schema, but not "tel"
https://rossbulat.medium.com/deep-linking-in-react-native-with-universal-links-and-url-schemes-7bc116e8ea8b
had the same problem. I added these intent filters to the AndroidManifest file
<intent-filter>
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.CALL_BUTTON" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</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:mimeType="vnd.android.cursor.dir/calls" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tel" />
</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="https" android:host="*ashnamoon.ir" android:path="tel/*" android:pathPrefix="/"/>
<data android:scheme="http" android:host="*ashnamoon.ir" android:path="tel/*" android:pathPrefix="/"/>
<data android:scheme="ashnamoon" android:host="*ashnamoon.ir" android:path="tel/*" />
</intent-filter>
clicking on the links below will suggest my app and you can get the data with Linking API of react-native you can read about here.
test this link https
test this link http
test this phone
test this link https
test this link http
test this link ashnamoon
I add some links that helped me. this will only solve the problem on android not sure how can it be done in ios though
https://developer.android.com/reference/android/content/Intent
https://android.googlesource.com/platform/packages/services/Telecomm/+/a06c9a4aef69ae27b951523cf72bf72412bf48fa/AndroidManifest.xml

A link generated from the web site does not open in my app but same link genrated from app its work properly

In my android app code Manifest file contains following Intent filter for handling a Link in the app but doesn't work
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="safimoney.com"
android:pathPrefix="/.*/transactions/request-money/confirm/.*" />
</intent-filter>
test it with link generated from web "https://safimoney.com/en/transactions/request-money/confirm/0CnpXE7u5hXRD1JVcZM2APHcYElKZvBZs8GeqimJ" but it doesn't ask for an open link in the app.
If you want your app to open a link, use below code.
String url = "http://www.example.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
It will ask to select browser while opening this link.
You wanna do a Deep Link, right?
<intent-filter>
<data
android:host="open"
android:scheme="companyName" />
<data
android:host="companywebsite.com"
android:scheme="http" />
<data android:scheme="https" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
I would suggest for you take a look in Branch.io for link-app solutions.
But if you wanna make a webView inside your app this tutorial can help you.
This is one of the cases where developer.android website has everything that you need, even code examples. Just need to ready with a lot of attention. Hope it helps
EDIT
About your data, looking on android developer website, this should be the better way to set:
<data
android:scheme="https"
android:host="safimoney.com"
android:pathPrefix="/en/transactions/request-money/confirm/" />
But even after this you should add a data like this
<data android:scheme="safimoney"
android:host="/en/transactions/request-money/confirm/" />

How to launch the app from SMS content (link)

i need to launch my app when click on link that is received by sms or email.I mean, the person who receives the SMS simply taps on the link provided, and that launches the application.
Which ever Activity you want to open, when Link is clicked
Need to be use IntentFilter in Menifest like this
<activity
android:name=".interacting.InteractWithApps"
android:parentActivityName=".index.IndexActivity">
<intent-filter>
<data
android:host="www.domain.com"
android:scheme="http" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
You also need to define link schema and host
You should follow as per this link

Open my app by URL from browser's address bar like flipkart does

I writed a simple Android application and added a intent filter like this:
<intent-filter>
<data android:scheme="http" android:host="www.somesite.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Now, when I click by link from another application (like GMail) i see a dialog: choose application for run: MyApp or Browser.
But when I type this URL in browser's address bar it just open a site.
How can set up my app like a Google Play, Google+, flipkart? (When I type a http://play.google.com/ - i see a dialog Google Play App or Browser)
Its all about Broadcasts and Intents! The idea is that your app declares in the manifest that it can receive certain messages.
From this answer:
Basically, what you'll need to do is define your own scheme. Something
along the lines of:
<intent-filter>
<data android:scheme="anton" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" /> <--Not positive if this one is needed
...
</intent-filter>
Then you should be able to launch your app with links that begin with the anton: URI scheme.
add this source into manifest file
Adding the following fixed the issue:
So the intent filter looks like:
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:host="example.com"> </data>
<data android:scheme="https"></data>
<data android:pathPattern=".*"></data>
</intent-filter>

Application appears in the “share” list ANDROID

How can I do that my application appears in the “share” list of another application? For example, I want to choose a pdf file and send it to my application.
I can’t find the solution, any idea?
Thanks
You can add an intent filter in your AndroidManifest.xml
for example for a pdf you can indicate the mimeType application/pdf.
<activity name="package.name.MyActivity">
<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:mimeType="application/pdf" />
</intent-filter>
</activity>
Look at the documentation at http://developer.android.com/guide/components/intents-filters.html#Receiving

Categories

Resources