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>
Related
I'm trying looking for resources to know how to share audio from WhatsApp to my app, but I can't find any. I only have found how to share from app to WhatsApp but not from WhatsApp do an android app. If you know some resource that may help me, I will be very happy with it.
Cheers!
You should use a intent filter for your problem such as a one below,
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file"/>
<data android:mimeType="audio/*"/>
</intent-filter>
I think the action needs to be changed.
An intent filter must be defined in the Manifest.xml file
After declaring the intent-filter your Manifest.xml will look like this,
<activity android:name=".MainActivity">
<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" />
<data android:scheme="file"/>
<data android:mimeType="audio/*"/>
</intent-filter>
</activity>
Let's say in my app, users can make posts & send messages to other users, & I want to register my app as a component among those appears in the Share-via picker when sharing either text or an image, I'm defining my 2 activities in my AndroidManifest.xml as follows (like this official example):
<activity
android:name=".SharePostActivity"
android:label="MyApp (Post)">
<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" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
<activity
android:name=".ShareMessageActivity"
android:label="MyApp (Message)">
<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" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
When sharing text, this works perfectly fine, where I see 2 icons of my app among available apps for sharing text, named MyApp (Post) & MyApp (Message),
Problem happens when sharing an image, because only one icon appears with the second defined label in the manifest (which is MyApp (Message)), and actually it opens the first defined activity in the manifest (which is SharePostActivity),
So, how to show the 2 options when sharing an image (just like what happens when sharing text)?
(I've tried on an emulator running Nougat & a real device running Oreo)
----- Update -----
I've found that this weird behavior happens only when sharing images from Google's Photos app, but everything works fine when sharing an image from other apps!
Some investigation leads to a solution: each of your intent-filter must contain an android:label which points to a resource, not a hardcoded string.
...
<intent-filter android:label="#string/first_value">
...
Different Activities must have different labels, so in your case the Manifest should look like
<activity
android:name=".SharePostActivity"
android:label="#string/my_app_post">
<intent-filter
android:label="#string/my_app_post">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter
android:label="#string/my_app_post">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
<activity
android:name=".ShareMessageActivity"
android:label="#string/my_app_message">
<intent-filter
android:label="#string/my_app_message">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter
android:label="#string/my_app_message">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
I'm building a app with sounds to be shared via WhatsApp, it's almost done, however is missing a single thing, that I already tried everything, but nothing seems to work.
I wanna that when the user click on share button of own whatsApp (the one that is a clip) my app be listed on list of possible apps to do that action, this way:
I already tried
use a intent filter on a activity like
<intent-filter>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="audio/*" />
</intent-filter>
and too
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:mimeType="audio/*" />
</intent-filter>
however my app wasn't shown, I already saw that is possible with other apps, I'm just doing something wrong.
How I can do to make my app be listed? Anyone knows?
Really Thx.
Note - the image is just a example, not a real one 'cause I can't print the screen of a real device, then I found this one on internet :(
EDIT 1
I tried this way too, but did not work
<activity
android:name=".activities.HomeActivity"
android:exported="true">
<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.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="audio/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.OPENABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="audio/*" />
</intent-filter>
</activity>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="audio/*" />
</intent-filter>
//and too
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:mimeType="audio/*" />
</intent-filter>
Replace With below code
//this is to get text from other app
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="audio/*" />
</intent-filter>
For more idea here is an official document form android : https://developer.android.com/training/sharing/receive.html
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.
is there any way to share text from my android app by using ACTION_SEND and google+ app.
Has anyone try that, which mimeType should i write?
Thanks for your answers
I am pretty sure that Google+ app has intent filters for text/plain and image/*. Here's what they have in the manifest:
<activity android:theme="#style/CircleBrowserTheme" android:name=".phone.PostActivity" android:launchMode="singleTop" android:logo="#drawable/ic_menu_stream">
<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" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</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>
So you should be able to putExtra a String onto your intent and setType("text/plain") and that will most likely work just fine. Looks like you won't be able to send both a text and a picture at the same time, though, as SEND_MULTIPLE on G+ only takes images.