Launching app from sms link or email link
It can be done.
The way I would structure it is by having a redirect from a server you control.
- You send the user a link that points to your server.
- You try to launch your app using the custom URL scheme.
- If it fails, you redirect the user to the app store so they can download your app.
Here is an interesting question with several ways to check if the launch attempted via your custom URL was successful.
How to launch the app from SMS content (link)
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
How to launch an app from a SMS message in Android and iOS, along with encrypted data for the apps to use
You cannot add http://
in front of com.app.myapp://
because they are both uri schemes. You should familiarize yourself with the difference between URI Schemes and App Links. Since you are using URI schemes
to accomplish this, you should not be using .
. Your URI scheme should look something like myapp://
not com.app.myapp://
. This is probably why Android Messenger is ignoring everything after the ://
.
An easier solution would be to use Branch SDK and pass along the encrypted data in the link data.
EDIT
Android messenger does not recognize raw URI schemes as clickable links. You probably still need to use http
for android. You should look into using Android app links and iOS universal links. These take a bit more set up but should handle links in both cases
Launch an app from a link in an SMS
Good news, it is possible and quite simple (really easy in fact)
Take a look at this tutorial
Update : it seems that the SMS app doesn't auto recognize that address type
opening application from the sms/email link
You can create a custom scheme (i.e. a special type of 'link'). If you send such a link via SMS and user clicks on it, then a registered app will be started.
Edited to provide example:
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="http" android:host="com.yourhostname"/>
</intent-filter>
Where you change com.yourhostname
for your site hostname. So of you send some url in SMS that contains this hostname, e.g. 'http://www.yourhostname.com/some-generated-path', then if user has you app installed this link will be opened by the app, but if not then link will be opened in browser still giving you opportunity to show the content to this user.
Android sms with link to application or Google play
Ex: Your link will be something like https://example.com and you have the intent filter in Android Manifest as below:
<activity
android:name="com.droid.MainActivity"
android:label="@string/app_name" >
<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="example.com"
android:scheme="https" />
</intent-filter>
</activity>
Use the URL Mapping editor to easily add URL intent filters to your Activities with Android App Links (Android Studio > Tools > Android App Links).
Launch android app when a link is tapped on SMS
In you Manifest, under an Activity that you want to handle incoming data from a link clicked in the messaging app, define something like this:
<activity android:name=".SomeActivityName" >
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
<data android:scheme="com.your_package.something" />
</intent-filter>
</activity>
The android:scheme=""
here is what will ensure that the Activity will react to any data with this in it:
<data android:scheme="com.your_package.something" />
In the SomeActivityName
(Name used as an illustration. Naturally, you will use your own :-)), you can run a check like this:
Uri data = getIntent().getData();
String strData = data.toString();
if (strScreenName.equals("com.your_package.something://")) {
// THIS IS OPTIONAL IN CASE YOU NEED TO VERIFY. THE ACTUAL USAGE IN MY APP IS BELOW THIS BLOCK
}
My app's similar usage:
Uri data = getIntent().getData();
strScreenName = data.toString()
.replaceAll("com.some_thing.profile://", "")
.replaceAll("@", "");
I use this to handle clicks on twitter @username links within my app. I need to strip out the com.some_thing.profile://
and the @
to get the username for further processing. The Manifest code, is the exact same (with just the name
and scheme
changed).
Related Topics
Uitableview Automatic Dimension Not Working Correctly
Alamofire Request Gets Stuck When Entering Background
Raw Depth Map Sdk for iPhone X
How to Use Pod in Notification Service Extension
Core Data - Fetch All Entities Using the Same Field
Get The Data from All Children in Firebase Using Swift
Map Object into 2D Array Swift for Tableview Sections
Uicollectionview - Horizontal Paging with One Cell at a Time
Best Approach to Change Xib Direction Programmatically
Indexpathforrowatpoint Returns Nil Only for First Cell in a UItableview
Should I Use Realm Objective-C or Realm Swift in My Mixed Objective-C/Swift Project
iOS Add Button to Widget Extension
Nscoding Required Initializer in Inherited Classes in Swift
Uicollectionviewcompositionallayout - Center Items in Sections or Groups
Default Uifont Size and Weight But Also Support Preferredfontfortextstyle
Paste Formatted Text, Not Images or HTML