I am new in the android application development and I have to create the application which have ability to take the URL link via browser and send it to users which are using this application, I know It is done with the help of intent filter but i don't know what should I have to for that , how our application name put into the browser shearing list. if we consider example then when we can open browser and share link via Bluetooth and Google+ and Facebook and etc.. how to add or application in this list and how to create the android activity for that. can anyone knows about this ??
Asked
Active
Viewed 3,174 times
1
-
1That's entirely too many questions in one sentence. Could you please clarify? – durbnpoisn Apr 15 '14 at 19:50
-
OK sorry for that, and my question is how we can get the shared link via browser in our application and how to process it. @durbnpoisn – shiv Apr 15 '14 at 19:57
-
Do you mean like, adding in Facebook Like, Google +, or Twitter icons? – durbnpoisn Apr 15 '14 at 19:59
-
no sir. my question is similar to http://stackoverflow.com/questions/8126299/android-share-browser-url-to-app but I dont get from where to start devlopment of this app. @durbnpoisn – shiv Apr 15 '14 at 20:24
-
Ok. After reading the linked thread, this is what I think. (not "know", "think"). That system service is populated by the account settings on your device. So, if you have a Facebook account, Facebook will show up as one of the options for sharing. To get YOUR app on that list, you would need to have an account that the system is aware of. So, it's not just as simple as modifying some XML somewhere. – durbnpoisn Apr 15 '14 at 20:30
-
Thanks for respose sir but I get answer from this link :) @durbnpoisn http://stackoverflow.com/questions/8624315/make-android-app-listen-to-shared-links this is what I want , – shiv Apr 15 '14 at 20:35
-
Okay. That's good. But I'm actually still a little curious myself. I had seen it happen once, where I wanted to share something on Facebook, but I wasn't signed on. So that share didn't appear on the list. I signed into my account, and then it was there. So, I thought those things were all related. – durbnpoisn Apr 15 '14 at 20:37
1 Answers
6
Yes you can do this by the following code:
first of all you need to add the following code in your manifest file:
<activity android:name="YouActivityNameHere">
<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/*" />
<data android:mimeType="video/*" />
</intent-filter>
<meta-data/>
</activity>
Now the above code tell the android OS to add this activity in shared list of only text,image and video.
And now your application have ability to handle share data only for text, image and video.
and next thing is that for handling data you have to handle the your YouActivityNameHere.java
file and there code is neaar about similar to follows code:
if (intent.getAction().equals(Intent.ACTION_SEND)) {
String text_data = intent.getStringExtra(Intent.EXTRA_TEXT);
// and now you can handle this text here what you want to do.
}
I think this is little bit helps you :)

Code_Crash
- 734
- 5
- 22