I have defined an intent filter in order to launch my app from some kinds of URLs. The point is that it is launched for all the kinds of links, and I only want to be launched for a concrete host name. Here is my manifest:
<activity
android:name="com.imin.SplashActivity"
android:label="#string/app_name"
android:launchMode="singleTask"
android:logo="#drawable/img_action_icon"
android:screenOrientation="portrait"
android:theme="#style/AppTeme.Fullscreen" >
<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:host="imintheapp.com"
android:pathPrefix="/events/get/"
android:scheme="http" />
</intent-filter>
</activity>
I need to open my app ONLY in the following cases: http://imintheapp.com/events/get/xxxxxxxx where xxxxxxxx is an alphanumeric string.
What I am doing wrong?
Regards,
Add this code in Menifest.xml
<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.parag-chauhan.com"
android:path="/test"
android:scheme="http" />
</intent-filter>
For test create another project and run below code
Intent i = new Intent(Intent.ACTION_VIEW , Uri.parse("http://www.parag-chauhan.com/test"));
startActivity(i);
You can also pass parameter in link
for more info
http://paragchauhan2010.blogspot.com/2013/03/make-link-in-android-browser-start-up.html
Try this
<data
android:host="imintheapp.com"
android:path="/events/get/"
android:scheme="http" />
I think you should look at the intent-filter element of your Mainfest file. Specifically, take a look at the documentation for the data sub-element.
Read those docs again.
I also suggest you to read the 2nd ans of this Que.
Related
PLEASE HELP MEEEE
In my application i want use DeepLink and for this i write below code.
But when run application not suggest my application and just show in Chrome browser !
My Url : sosapp://sosapp/hashcode/ghfhgfhgf?
My codes :
<activity
android:name=".Activity.LandingActivity"
android:screenOrientation="sensorPortrait" />
<activity
android:name=".Activity.MainActivity"
android:screenOrientation="sensorPortrait">
<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:scheme="sosapp" android:host="sosapp"/>
</intent-filter>
</activity>
How can i fix it and when click on this Url from mobile, suggest my app ?
I have tried use your link in my Activity and works fine.
my Activity Manifest:
<activity android: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:host="sosapp"
android:scheme="sosapp" />
</intent-filter>
</activity>
and my intent used to call the activity
val action = Intent()
action.data = Uri.parse("sosapp://sosapp/hashcode/ghfhgfhgf?")
startActivity(action)
Add pathPattern to your data tag like below:
<data
android:host="sosapp"
android:pathPattern="/*"
android:scheme="sosapp" />
Try adding label, it's mandatory for higher versions of android. See example from the docs. They always include a label for intent-filter
<intent-filter android:label="#string/filter_view_example_gizmos">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "example://gizmosā -->
<data android:scheme="example"
android:host="gizmos" />
</intent-filter>
How to avoid multiple instances of the app for deep-link. and also email verification is not completed or its not verified even after clicking Get Started and choosing one of the these 2 below apps. how to verify the account on clicking the Get started button , immediately launching the App single instance.
Probably,you declare two activities for DeepLink Check Your manifest file you must create two Activities with Browse able , And with Same Host and Schema. Remove Browse able tag from one of them OR change Schema.
OR
Your Device (emulator) having two application with Activity having same Host and Schema. may you have tested your code for DeepLinking .
This is probably because of adding the nav graph option in more than one activity
in my case:-
<activity
android:name="com.aatec.bit.ui.activity.SplashScreen"
android:exported="true"
android:theme="#style/Theme.customSplash">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<nav-graph android:value="#navigation/nav_graph" />
</activity>
<activity
android:name="com.aatec.bit.ui.activity.main_activity.MainActivity"
android:exported="true"
android:launchMode="singleTask"
android:theme="#style/Theme.BITApp"
android:windowSoftInputMode="adjustResize">
<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="http" />
<data android:scheme="https" />
<data android:host="bitapp-eng.github.io" />
</intent-filter>
<nav-graph android:value="#navigation/nav_graph" />
</activity>
I just remove nav_graph from my splash screen activity
<activity
android:name="com.aatec.bit.ui.activity.SplashScreen"
android:exported="true"
android:theme="#style/Theme.customSplash">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.aatec.bit.ui.activity.main_activity.MainActivity"
android:exported="true"
android:launchMode="singleTask"
android:theme="#style/Theme.BITApp"
android:windowSoftInputMode="adjustResize">
<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="http" />
<data android:scheme="https" />
<data android:host="bitapp-eng.github.io" />
</intent-filter>
<nav-graph android:value="#navigation/nav_graph" />
</activity>
I'm trying to add deep linking to my app and when I add:
<data android:scheme="http"
android:host="www.example.com"
android:pathPrefix="/gizmos" />
to the intent filter in my MainActivity the icon is not installed in the device after compiling.
Here is the activity part on the manifest:
<activity
android:name=".MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:windowSoftInputMode="adjustPan"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http"
android:host="www.example.com"
android:pathPrefix="/gizmos" />
</intent-filter>
</activity>
You need two separate intent-filter.
<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:scheme="http"
android:host="www.xxx.com"
android:pathPrefix="/app" />
</intent-filter>
Docs say:
When you want to handle multiple kinds of intents, but only in
specific combinations of action, data, and category type, then you
need to create multiple intent filters.
So, you should define multiple intent-filters so that each of which will handle a separate concern.
One for MAIN / LAUNCHER. (Showing icon of your app in the launcher)
One for VIEW / BROWSEABLE.
I want to launch an activity when a link is clicked on android browser.
I have followed the instructions provided by the link .
When I open the browser and click on the link, the play store is lauched.
This is my href code contained in the html page:
intent://scan/#Intent;scheme=test;package=com.exekon.appbrowser.MainActivity;end
this and this is the code in the manifest:
<activity
android:name=".MainActivity"
android:exported="true"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="test" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
Can anyone proved me an example?
Thanks
Look at the zxing source code mentioned in the instructions you used:
<data android:scheme="test" android:host="scan" android:path="/"/>
check the scheme definition into the AndroidManifest.xml
<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="zxing" android:host="scan" android:path="/"/>
</intent-filter>
you must use something like:
<data android:scheme="test" android:host="scan" android:path="/"/>
This question already has answers here:
How to make my Android app appear in the share list of another specific app
(8 answers)
Closed 8 years ago.
How do i make my application appear here? :
some informations led me to put this code on my Manifest (See code below) but it doesn't work. The thing is if i want to share an image from my gallery, i want to see my app on the list of app on the share list. Any pointers? please help.
<activity
android:name="com.my.package.MyIntent"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.ALL_APPS" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
Thank you :)
Try this way
<activity
android:name="yourActivity"
android:icon="#drawable/ic_launcher"
android:label="test">
<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.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
For more information go to Receiving Simple Data from Other Apps and Sending Simple Data to Other Apps
Intent Filters - Android Developers
Information:
Note: In order to receive implicit intents, you must include the
CATEGORY_DEFAULT category in the intent filter. The methods
startActivity() and startActivityForResult() treat all intents as if
they declared the CATEGORY_DEFAULT category. If you do not declare
this category in your intent filter, no implicit intents will resolve
to your activity.
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
<data android:mimeType="image/*" />
</intent-filter>