Is it possible to open android app from Gmail with deep link - android

When clicking my custom deep link in gmail I get redirected to the browser by default. Meanwhile doing the same from Outlook opens my app nicely.
Here is my intent filter:
<intent-filter>
<data
android:host="my.domain.com"
android:port="9201"
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>
Edit: spelling

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

How Can I Create an Intent to 'Open In App' but Not from the Browser

I've got an intent in my AndroidManifest.xml working great. When a person visits a page called "train", the actions specified in my ActivityMain are carried out.
However, my website includes some features which are not available in my app.
So i'd still like users to be able to navigate around my website with ease, without links to the train page on the browser opening the app.
Does anyone know how I can use an intent-filter to prompt the user with the option to "open in app" from apps such as Gmail, Messenger, etc, but NOT when they're on my website going to the specified page?
<intent-filter>
<data android:scheme="https"/>
<data android:host="example.co.uk"/>
<data android:path="/train/"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
<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:host="example.co.uk"
android:path="/train/"
android:scheme="https" />
</intent-filter>
For further information you can view detail here about deep linking:
https://developer.android.com/training/app-links

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>

Opening the custom file format in my application instead of downloading it on Android

When user type the url to my .someExt file in his web browser (on Android Phone), the message appears:
This content is unsupported content. Do you really want to download?
Instead, I would like to associate the .someExt (my custom file extension) with my Android Application (that the user has downloaded previously) so when user type the url to .someExt in browser my Application will open the file.
How to achieve it? I guess it has to be done with manifest and some "handle" method in my Activity.
Based on: Associate App with file extension - Intent filter Not working?
I have used:
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</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="application/someExt" />
</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:host="*" />
<data android:scheme="file" />
<data android:scheme="smb" />
<data android:scheme="content" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.someExt" />
</intent-filter>
</activity>
Now, when user type the url to my .someExt the file is being downloaded and I can open it when downloading is done (so my Application will run it). But I don't want all those additional clicks - I want it to be:
User click the link to .someExt on the website.
The .someExt opens in my Android Application.
And not the:
User click the link to .someExt on the website.
The file starts to download.
User open "downloads" and click on downloaded file.
The .someExt opens in my Android Application.
I don't think you can realize this feature in Android with different kind of browsers. The URL user type is handled by the browser most of the time. How to deal with the scheme is decided by the behaviors of the browser. If your scheme is http, the browser will try to open with it own and handle by itself.
Currently, most browsers add support for market scheme. If the URI's scheme is market, it will jump to Google Play or other markets.
But is can be done from other app with Intent.
Declare your activity like following to receive the ACTION_VIEW action.
<activity
android:name=".MainActivity2Activity"
android:label="#string/title_activity_main_activity2">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="com.example.myapp"
android:mimeType="*/*"
android:pathPattern=".*\\.someExt"
android:scheme="http" />
</intent-filter>
</activity>
From other apps, you could do like this.
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("http://com.example.myapp/test.someExt"), "*/*");
intent.setPackage("com.example.myapplication");
startActivity(intent);

android magnet link data filter

I want to launch an Android activity from my app when the user selects a magnet link in the browser.
According to the docs, A URI is specified by separate attributes for each of its parts:
scheme://host:port/path or pathPrefix or pathPattern
The problem with magnet links is that they have a different pattern, like magnet:?xt=......
I tried something 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:scheme="magnet"
android:host="*"
/>
</intent-filter>
but it did not work (the activity didn't launch when I opened a magnet link in my browser). Could you help me in correctly declaring an intent filter for magnet links?
I got this to work for me:
<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="magnet"
/>
</intent-filter>
Basically, I removed android:host

Categories

Resources