I want to add my app into the share dialog in Android.
So that the user can select an image and "share" it with my application,
which would do some modifications before emailing it.
Any ideas how to where to start?
You need to add an intent-filter to your application manifest, that allows it to handle objects of the MIME type image/jpeg.
Your application then receives a Uri to the file, and you can use that Uri to modify the image, as requested.
There's a lot about it on the Android developer site, including code samples:
http://developer.android.com/guide/topics/intents/intents-filters.html
Related
I want to disappear/hide my application name from other application or phone default sharing list.
Any help would be appreciated
It's actually opposite. It shows on that list because your app's activities listed in Manifest file contain <intent-filter> entries that match criteria for data someone wants to share (that's why you may not see your app for one type of shared data but see it listed for other). If you do not want to be listed, remove these intent filters from your manifest file and you should be good.
See this docs: https://developer.android.com/training/sharing/receive
If you desire to be able to handle share action for specific apps and filter unwanted apps from seeing your app in their share menu, then this is not doable.
As stated by docs you can only filter via data mime type that your app can handle
I want to create a feature in my app that will allow the user to save a social media post to the gallery. the idea is when the user presses share on the post, my app will appear in the share dialog, and by choosing the app, the image/gif/video will be automatically saved in the gallery. but the data that I receive from the intent is of type text/plain, naturally since the share feature provides a link to the post. however on 9gag and reddit for example, on the share dialog there's a "Save to Gallery" option that does save the post as a media file to the gallery. So my question is, is it possible to program a similar function in my app? what exactly do I need to do to achieve such a functionality? I am not asking for a code, just directions, where to look for an answer since i couldn't find anything on google about my topic.
Thanks in advance !
You need to look at intent filters https://developer.android.com/training/sharing/receive
The idea with these is you declare in your manifest the type of content your app can handle. Then, when a user shares a particular type of data, such as an image, from another app, then your app can be listed as an option to handle that image.
Hi I have to develop an application which should enable sharing of pdf files. I have to create a service wich puts my application as default for .PDF file sharing. As you can see on the picture I can share the pdf via bluetooth/Gmail/Drive...etc. I need to put there my application to. How can it be done? thanks :)
http://www.vogella.com/articles/AndroidIntent/article.html
Go here, then check
4.3. Example: Register an activity for the share intent
You need to register it as a reciever for the SEND action. An example is given here. The mime type for pdf is 'application/pdf'.
I think you cannot force that, its totally on android system, thats why it pushes for a chooser with all the apps that has registered themselves as handler for specified data type, following which user can mark it as default or not.
Is there any way to signal Android OS to open the package installer upon download of an .apk file?
Perhaps by Content-Type? or maybe an APK specific url protocol, like apk://apk.location?
Are you doing the download yourself in your own app, or are you trying to create some behavior in an external app?
I don't think you'll be able to trigger behavior upon download outside of your app (since the user would have to select the downloaded file in order to open it), but if you're handling the download yourself, I think you want this post on how to install an application programmatically.
Edit: Addressing your comment in which you said you are writing a website and want to be able to force the APK to be opened by a native app: I can think of a way to do something like it, but you would have to handle the download in the native app because you won't get the browser to do the download for you.
You'll need to register your native app to receive ACTION_VIEW Intents with URIs in whatever format you choose; I recommend using something like yourappname://localhost/escaped_download_url_to.apk. In your Activity get the path from the URI in the Intent and grab the last part of it (URI handling is broken into a few components: protocol, host, and path). Unescape it as necessary and then start the download manually in the app, and then upon completion you open the downloaded APK from wherever your app put it, using the link I provided.
So long as you make sure your mobile website provides an href to yourappname://localhost/escaped_download_url_to.apk, you'll be able to trigger this behavior. When the user clicks that link, it should provide a dialog to choose which app to use to open it (if they have more than one app capable of doing so) which when they select your app will launch the Activity that you registered with the Intent filter.
Edit the second: you probably don't need to do any escaped URIs; just using a made-up URI protocol as you suggest in your own post should work, so long as your app registers to receive Intents with that protocol. yourappname://yourserver.com/my/location.apk will work. All that really matters is being able to pull the download URL out of the data you give to the app in the URI.
I am not sure whether it is applicable or not in an Android?
I had received an email with an attached .CSV file...Now when I will click on that attachment then It could give me an option to open this attachment in xyz application..I want to implement this only on .csv attached file.
Please give me some hint that Is it possible ??
Thanks..
If it's your app, I believe you just have to associate that file type with the app using the Android manifest. See this question for details:
Android intent filter: associate app with file extension
As the #Ken Fehling suggested, you must approach this way.What actually gonna happen by this is, when you click on the attchment after its downloaded, Android OS will ask you and give a option containing all the apps that can open .csv file.Now as you have mentioned the mime type or android:pathPattern in your app, the option list will contain the name of your app too.