We are trying to implement deepLink from a Gmail in our app. I add following code to my Manifest file :
<activity
android:name="io.fetchcar.archapp.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="#string/filter_view_fetch">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="fetch" />
</intent-filter>
</activity>
In the Gmail we have following button with html code :
Fetch A Car Now
But when we click on the button from Gmail, it does not open the app.
The thing is if we open it as a web page in the browser and click on Fetch A Car Now button, it opens our app as expected.
Is it any limitation to open our app with Deeplink from Gmail ?
Related
I am trying read barcod and then get URL from this barcod and then trying to open this URL. it show this page which is open with app or continue with browser . even if select open with app . it will ask me this page next time. how can directly open this url with Autocad a360 app.
this is my code:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(StringURL));
startActivity(intent);
Add this code to manifest.
<activity
android:theme="#style/AppTheme.Launcher"
android:name=".features.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="YOURSITE.com"
android:scheme="http" />
</intent-filter>
</activity>
App will launch when you try to open http://YOURSITE.com
Deep link was correct answer
Launch app when click on url if app installed on device. if app not installed on device, open playstore.
<activity android:name=".ui.NewsCardActivity">
<intent-filter>
<data android:scheme="app" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
You have to deep link your app, add following lines in activity (Manifiest.xml) which you want to launch
<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="screen" android:scheme="appname"/>
</intent-filter>
in browser when ever you click appname://screen your app activity will be launched,
replace appname and screen as per your requirement
Note if you type this url in browser it will search in google ,for this to work you have to write link in html page
Some text
If not working the add android:exported="true" in activity
<activity
android:name=".activity.MainActivity"
android:exported="true">
Hello friends i have one GMail which include inside one button like "Confirm e-mail" as below
When i click on Confirm e-mail button it is gone to register page inmy website browser. But at that time i wnat to developed flow like if my application is installed in my phone than it should be show popup like wheather this page open in form browser or in my application like below image
See above image it is demo for Linkedin application , same way i want to implement in my application it should be comes my application name when i click on conform e-ail button in Gmail body part
I also make change in my menifest code as like vbelow
<activity
android:name="pkg.android.rootways.worldofrental.Registration"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|stateVisible" >
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
But it is not working so any one have idea how can i make it possible in my application ?
EDIT
<activity android:name=".Registration"
android:exported="false" >
<intent-filter>
<data
android:scheme="http"
android:host="www.secure.worldofrental.com"
android:pathPrefix="WOR" >
</data>
<category android:name="android.intent.category.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<action android:name="android.intent.action.VIEW" />
</intent-filter>
Could you please try adding android:exported="false" for your activity in the manifest
Below is code which is work for me. Hope it helps to you.
Pass the tag in intent-filter in your main activity to open application when the URL is called.
<activity android:name=".MyMainActivity"
android:exported="false" >
<intent-filter>
<data
android:scheme="http"
android:host="www.your website name.com"
android:pathPrefix="/your application name" >
</data>
<category android:name="android.intent.category.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
If user navigate to "www.your website name.com/your application name" and application is installed in youe mobile, then intent will be create and activity will be called. You can also redirect play store if application is not installed in your mobile.
I have already opened my android application. I used url scheme, so that my app can be opened from the users email. But if i try to open my application from clicking email link from the web browser, it will open that application in separate window. (Please see my attached screen short picture) .
How to avoid my application to open twice separately?
<activity
android:name="com.mYs3.MainActivity.flash_screen"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="mYs3" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
try this line in your activity block in manifest
android:launchMode="singleTask"
There are many answers in stackoverflow showing how to lauch app from a web browser ,but I am not sure what went wrong with my code, that never seems to be doing the intended.
I am trying to launch my app by a URL from any other app like web browser,initially
my manifest file looks like this
<activity android:name=".Main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="http" android:host="ebay.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
And When I typed http://ebay.com in the browser that never started my app.Obviously,how does the browser know about my app?,then i tried the other way around and added another Activity called MyActivity and altered the manifest file as
<activity android:name=".Main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MyActivity">
<intent-filter>
<data android:scheme="http" android:host="ebay.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
and tried in my Main Activity
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("http://mycityway.com")));
Thus producing the intended result.I can also start another application Activity using this method.
But most of the answers here says that the later is possible.What is the mistake i am doing,I couldn't launch my app from browser.Please guide me.
And When I typed http://ebay.com in the browser that never started my
app.
It gets started when a matching link is clicked not when you type the url in the browser.
Try it by sending yourself an email containing http://ebay.com and click the link in the email application.