Share pdf file via my application on android - android

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.

Related

Can android intent be used to access phone directory?

I am making an android app to open a file and send it back to a remote server. I know how to do this with a file hardcoded into the app but I want to make it so that it can search the phone's directory, choose a file then send it. I am wondering can this be done with an intent? Or is there any other approach that could be used?
Yes, you can do this with an Intent. You would use startActivityForResult() and specify an Intent that can launch a file picker. Now the actual Intent you use depends on which application(s) you expect will actually service this Intent for you. For example, ES File Explorer exports a custom PICK_FILE action that you can use to support a file picker. With any scenario where you rely on a third party application to provide a service, you'll want some sort of fallback in case no application can handle the Intent (such as linking to an app that implements the Intent in the Google Play store). A similar question may provide some additional Intents to try for a variety of different file choosers available.

unity3d: How to register custom document kind and open it by my application?

I need to register my own document type, for example ".mydoc" and associate it with my Unity3D application in the iOS and Android. For example if someone send my email with something.mydoc file I need to be able to tap on the file and system will prompt to open this file with my application.
I need to do the same thing as here:http://www.raywenderlich.com/1980/email-tutorial-for-ios-how-to-import-and-export-app-data-via-email-in-your-ios-app but in my Unity3d application for iOS and Android. I need to be able to open attachments in the emails by my application. Any ideas how to do it in Unity3d?
Thanks!
I have not tested this but maybe this will get you started?

Open android package installer upon download of .apk file

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.

Email attachment open in application?

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.

How to write an Android share "plugin"?

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

Categories

Resources