Phonegap 3.0+ How to print a document and/or send it to another device via email/airdrop/etc without using Mobile Safari - ios

I'm working on a Phonegap 3.1 iOS app.
What I have currently:
I'm using the InAppBrowser plugin to view user-uploaded documents from a server.
The document types users upload are commonly (but not limited to) the following:
.pdf
.png, .gif, .jpeg
.xls, .doc, .ppt
.txt
What I want to do:
Viewing the files works well in the InAppBrowser, but now I am exploring ways that users could send the documents to each other.Mobile Safari has a share button that allows a user to send a file by airdrop, message, mail, tweet, facebook or airprint. I cannot, however, use Safari since it is a non-negotiable requirement that I do not expose the URL where these files are hosted.
The InAppBrowser allows me to hide the location from the user, which is not possible with Mobile Safari. I want to be able to email and print a document without ever exposing the url where that document lives.
Is it possible to create the same sharing mechanism from within a Phonegap app?
What I know so far
I'm aware of the Phonegap File plugin for uploading and downloading files.
If I were to download a file from the server so it was stored locally, how would I go about making it shareable (through email, airdrop, etc)?
From what I can tell, there are no relevant Phonegap 3.0+ compliant plugins to achieve this so I would think I need to create my own. Am I on the right track?

Related

Is there a way to send content from my app, which is not from my app?

I have a theoretical question to the file system/restriction from iOS.
In an Android app I can open a file from filesystem, with my app, and send it via mail or send it to a REST-service.
This is not possible under iOS, because there is no filesystem like under Android.
As far as I know I can only send file, which are created by my app.
Is there a way to send content from my app, which is not from my app?
For example a pdf received per mail, opened in my app and send it to a server or something else.
best regards
Yes, you can make your app eligible to open specific type of files ( images, videos, pdf, docs, etc )
see https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/RegisteringtheFileTypesYourAppSupports.html
After that you bring the url file and you can work on it locally into your app, or uploading the linked file on a server as well

How to allow user to upload attachments in iOS application

In case of Android when I want to send or attach a document such as a pdf or doc from my application I can easily access all the files in the external storage and share or attach.
But since iOS follows a sandbox approach as well as there is no filesystem so it is not possible to attach or upload in same manner.
In my iOS application right now, I have implemented Open In functionality, wherein in the info.plist file I have specified that my application supports all types of documents so when the user opens any documents he gets an option to Open In my application, then I save that document in the
Documents/Incoming
folder in the application, now when my user clicks to add attachment then he can see the document to attach, since this is a long process I was looking for better ones.
I saw whatsApp allows uploading/sharing from iCloud apart from that what can I do to provide a similar behaviour as Android.

How to save PDFs via an In-App Browser on the iPhone

I'm wondering if anyone knows of an easy way to allow for PDFs that are opened via an in-app browser I have created for the iPhone platform to be opened and saved via other PDF viewer apps. I have no problem making the in-app browser open the PDFs and allowing them to be viewed, I just can't open or save them with other apps like iZip.
When a PDF is opened in Safari, the browser automatically allows me to select which app I want to open and save the pdf in (such as iZip). When I open the same PDFs via my in-app browser, I cannot save them to iZip.
The ultimate goal is to allow people to view the pdfs in the in-app browser and let them email the PDFs to themselves. So far I haven't heard of a way to email the pdfs directly from an in-app browser, so I'm hoping that I can at least figure out how to link it out to other pdf viewers that can then be used to save and email the files.
Thanks for any help you can give me!

BlackBerry default app for Epub file type

I'm developing an Epub reader on BlackBerry java platform, and I'd like to know if there is a possible way to register my application as the default reader for Epub files, like if a clicked on an attached Epub file within an email, or a link to that file in browser, or even if I clicked on it while browsing all files locally, am I going so far with this? is it possible?
Try using the Content Handler APIs, which allow you to register an app to handle files of a particular extension and content type (e.g. .epub and type application/epub+zip).
See this BlackBerry reference document for more information
If you install the full SDK, you should also find the CHAPIdemo sample code under samples/com/rim/samples/device/chapidemo.

forcing a file to open in predefined application in iOS

I am trying a simple web app which downloads files from internet and saves on iPad. Theses files are of .pdf,.xls,.doc, etc format. Now, I want to assign a default application to open a specific file type. (Say Adode reader for pdf file, Some image viewer app for image files etc). I dont want my app/os to decide which app the file should open in. Instead, if assigned app doesnt exists then it should give me a message that no such app found. Is it possible to do?
With a web app you cannot do such things.
If you go native, you can use Custom URL Schemes (see http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html)
But with Custom URL Schemes, you only are able to pass a view parameters. If you want more, UIPasteboard is recommended.
Apps are sandboxed. You cannot access other apps, nor their data!!!
But on native apps you can pass over data with pasteboard, call a custom url handler, pass a few parameters to cause the other apps to process your data.
Often App developers, like camera+ offer a documentation for the usage of their custom url schemes (Camera+ URL Schemes API)

Resources