Comments (29)
I am sorry but since long, I have no access to an iOS device to test anything at all. Sometimes I can fix some minor Objective-C bugs based on the technical changes in the language, but not user interface stuff.
If it works when opening with iBooks, it means this plugin still works correctly. I am not sure what Mail.app expects to receive and how attaching a file works with it. Maybe first you should save the PDF to the sandbox and then try to figure out how to launch Mail.app and immediately attach a file?
from cordova-plugin-file-opener2.
Hi @pwlin
Thanks for replying. I'll have a look next week. Perhaps I can get some errors from the logs or even figure out how I can get it to work.
from cordova-plugin-file-opener2.
Hi @pwlin
I have just plugged in my iPhone and started the app from Xcode. As said when I open it in iBooks it's all fine and there aren't any issues. If I open it with the mail app I get the following error.
2014-12-09 08:35:39.936 AnLog[1338:524306] LaunchServices: invalidationHandler called
2014-12-09 08:35:39.937 AnLog[1338:522756] Unable to get data for URL: The operation couldn’t be completed. (Cocoa error 260.)
2014-12-09 08:35:39.937 AnLog[1338:522756] Unknown activity items supplied: (
"<UIPrintInfo: 0x17806c840>"
)
2014-12-09 08:35:39.944 AnLog[1338:523157] LaunchServices: invalidationHandler called
As follows some debug information.
path NSString * @"file:///var/mobile/Containers/Data/Application/7A044B0C-FACF-497B-A9D3-A8A71798C29E/Documents//myfile.pdf" 0x00000001780efd00
fileURL NSURL * @"file:/var/mobile/Containers/Data/Application/7A044B0C-FACF-497B-A9D3-A8A71798C29E/Documents/myfile.pdf -- file:///" 0x0000000170293b00
Do you have an idea? I'll also keep looking into it.
from cordova-plugin-file-opener2.
Can you show the javascript part of your code where you call the plugin?
Also: Does the app crashes after that error? Or you just get nothing?
from cordova-plugin-file-opener2.
@marcelmalitz
I too had this issue, I solved it by actually configuring a mail application on the device. When I didn't have one configured it would not open the mail app, once I configured and set up the mail app it worked!
BUT @pwlin the problem I am faced with now is that once the mail app opens, (I can send mail OK) but if I cancel or even once sent, there is no return back to my underlying app (without closing and restarting the app). I am on latest IOS 8.1.2
from cordova-plugin-file-opener2.
Thanks @Mark-Leck for the tip. I hope it helps @marcelmalitz to fix his problem.
I am sorry I have no idea how to return to the main app. Can't you hold the home button on the device until you get a list of currently running apps, and then choose your main app?
from cordova-plugin-file-opener2.
Hi,
my apologies, I didn't describe this very well. My mail app is configured, it just doesn't attach the file to the new email.
The mail app opens a new email dialog where I can enter the body, change the subject, add recepients etc. This looks all fine. Unfortunately it doesn't contain a file attachment.
@pwlin please find the code I use to open a pdf file as follows.
cordova.plugins.fileOpener2.open(
// You can also use a Cordova-style file uri: cdvfile://localhost/persistent/Download/starwars.pdf
cordova.file.documentsDirectory + '/' + pdfFilename,
'application/pdf', {
error : function(e) {
console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
},
success : function () {
console.log('file opened successfully');
}
}
);
from cordova-plugin-file-opener2.
@marcelmalitz: can you please change the content type from application/pdf
to com.adobe.pdf
and try again? Will that make any difference?
from cordova-plugin-file-opener2.
@pwlin If I double tap home the weird thing is it is only my app that is running, the mail app is embedded on top of my my app (aka opened in the same instance) there is no option to return back. On the other hand if I open up say; Adobe reader, then reader does indeed open as a separate app so I am able to do what you suggest. I may try the suggestion you have made to @marcelmalitz so that the user can then send their mail via Adobe Reader. I will try and let you know!
EDIT:
I have tried the com.adobe.pdf but it didn't open adobe, it just gave me the standard IOS 'choose your application' pop-up screen....If I select mail then I am left with the image below and as you can see cancel does not give me any close option. The only way to return is to close my app and restart.
Strange how it ends up embedded on top of my application.
from cordova-plugin-file-opener2.
@marcelmalitz I have just been looking at you URL above and I am not sure if this helps but mine is formed slightly differently....
Like so:
@"file:///private/var/mobile/Containers/Bundle/Application/7A044B0C-FACF-497B-A9D3-A8A71798C29E/Documents//myfile.pdf"
from cordova-plugin-file-opener2.
@Mark-Leck and @marcelmalitz Have you ever tried Cordova Email Plugin? Maybe that would be a better choice to trigger Mail.app? There is also an example repo for that plugin.
from cordova-plugin-file-opener2.
@Mark-Leck Based on your screenshot, can't you click on Delete Draft
to come back to your main app?
from cordova-plugin-file-opener2.
@pwlin no non of the options available will return me back to my app. Yes I have been toying with using a standalone alternative, the only problem is that IOS will still offer the user the choice of using the default mail app.....If they do select that option then bam they are locked out of my app. Not really a solution I am looking for. I have even tried using inappbrowser plugin - injecting code - and then opening opening up mail app, but again mail app just takes over inappbrowser too. I am beginning to think this is a problem not currently solvable using phonegap or any of its related and current plugins.
from cordova-plugin-file-opener2.
@pwlin I changed the content type to com.adobe.pdf
with no success. I'll try the email plugin next in about three weeks time. I am on holiday from today.
@Mark-Leck as per your screenshot it doesn't look like that the actual pdf file is attached to your email draft. It populates the subject with the name of the pdf file but that is all it does. Try sending that email to a test email account. I doubt you will receive the pdf.
from cordova-plugin-file-opener2.
I'm experiencing the exact same problem as @Mark-Leck, the mail app is being launched inside my Cordova app and it doesn't let me get back, exactly as in his description and screenshots. I confirm this issue happens on iOS 7.0.5 on an iPhone 5S.
From what i can think of, it might be impossible to fix as i don't think it's your plugin that controls where & how these external apps are launched, or if you have any options. I'll let you know if i find anything.
from cordova-plugin-file-opener2.
And... here's something that weirdly solves the problem, for now at least. I found http://cordova.apache.org/docs/en/4.0.0/guide_appdev_whitelist_index.md.html , which says:
External Application Whitelist
Cordova 3.6.0 introduces a second whitelist, for restricting which URLs are allowed to launch external applications.
So, i tried adding that launch-external="yes"
attribute to my <access origin="*" />
tag in config.xml
, the obvious result being <access origin="*" launch-external="yes" />
. One would expect (as did I) that the Mail
app would now really launch externally, i.e. when you double tap the home button you'd see both your app and the Mail
app.
But no, the above results in the Mail
app being launched exactly as before, on top of your app. The difference is that it can now be closed via Close
-> either Delete draft
or Save draft
, or by sending the e-mail! YAY! At least i'm not forced to kill the app any more.
@Mark-Leck Please let me know if this solves the problem on your version if iOS as well, one way or another.
Have a nice day!
from cordova-plugin-file-opener2.
@dnwts Many thanks for the quick heads up ^ I eagerly rushed to try this but unfortunately no joy, I am wondering could this be a Phonegapbuild issue as I am using that for my .ipa's? Or are you using PGB too? Also are you using 'application/pdf' to launch? or?....
@marcelmalitz you are indeed correct, I know that If I open the mail app via Adobe Reader then it definitely attaches and sends (see image below). Eg: My App >> Adobe Reader >> Mail
from cordova-plugin-file-opener2.
@Mark-Leck i'm sorry to hear it's not working for you. We're not using PGB because of multiple headaches and slow updates, we're using basically cordova cli directly. It's more complicated to set up and maintain, but ultimately we gained complete control over what's going on.
Now, as far as i can see here http://phonegap.com/blog/2014/09/30/phonegap-3_6_3-now-on-build/ PGB seems to use Cordova 3.6, which should work. However, i am not convinced that PGB will actually translate the <access origin="*" launch-external="yes" />
tag into the exact same tag in config.xml
in the actual .ipa
output. Can you check and make sure?
As for the other question, yes i am using the application/pdf
mime-type for .pdf
, and it seems to work fine.
from cordova-plugin-file-opener2.
@dnwts I have opened up the .ipa and you are correct, PGB is omitting the launch-external="yes" from the config.xml tag. :(
I do have the CLI setup for android, I am not sure what is involved in configuring it for IOS though - I will look into this though.
Thanks for your help anyway!
from cordova-plugin-file-opener2.
@dnwts Great finds! thanks for clearing up some of the doubts.
@Mark-Leck setting up Cordova CLI for iOS is pretty straightforward, much like you do it for Android.
1- Add iOS platform:
cordova platform add ios
2- Build your app for iOS:
cordova build ios
3- Now open your app in XCode and do as usual.
from cordova-plugin-file-opener2.
@Mark-Leck @pwlin I'm glad i could help! While i still think PGB is a great service for pretty simple apps, it does suck at some things such as this, so you always need to check your packages to ensure that the output contains what you wanted. Some bottlenecks just like this one determined us to stop using it.
Best regards and happy holidays guys :)
from cordova-plugin-file-opener2.
@dnwts completely agreed. We don't use PGB too and prefer the simplicity and total control of Cordova CLI. I only submitted this plugin to PGB because people were asking for it. And with every update I must submit it again to PGB and wait for them to "approve" the new version....
Happy holidays to you too :)
from cordova-plugin-file-opener2.
@pwlin If only I had a Mac :-( (maybe next year) @dnwts I also agree, the more I use pgb the more I find myself constantly looking for workarounds.
Anyway all the best to both!!
from cordova-plugin-file-opener2.
Hi all,
Same problem as marcelmalitz, it opens correctly in iBooks but it is not attached to the email when opening with Mail app - only the file name in subject...
Any news about this problem?
Thank you.
from cordova-plugin-file-opener2.
@mbpmn I found that another plugin similar to this one, called:
cordova-bridge-open
https://github.com/cordova-bridge/open
This attaches the file correctly to everything I have tried it with.
Although it still doesn't solve my ongoing problem.
Hope that helps.
Hi all,
Same problem as marcelmalitz, it opens correctly in iBooks but it is not
attached to the email when opening with Mail app - only the file name in
subject...
Any news about this problem?
Thank you.
—
Reply to this email directly or view it on GitHub
#17 (comment)
.
from cordova-plugin-file-opener2.
@Mark-Leck
Thank you so much, this plugin works perfectly on IOS and Android !
from cordova-plugin-file-opener2.
@mbpmn Hay no worries, glad it worked for you!
On 13 Jan 2015 10:07, "mbpmn" [email protected] wrote:
@Mark-Leck https://github.com/Mark-Leck
Thank you so much, this plugin works perfectly on IOS and Android !—
Reply to this email directly or view it on GitHub
#17 (comment)
.
from cordova-plugin-file-opener2.
@Mark-Leck I tried the cordova-bridge-open plugin and it works very well. Thank you for this helpful advice.
@pwlin If you would like to get this working with your plugin it might be worth having a look into the cordova-bridge-open plugin code.
Thank you everyone for your help and contribution.
from cordova-plugin-file-opener2.
Thank you very much @Mark-Leck and @marcelmalitz I'm glad Cordova-Bridge worked for you. I will try to see its code and maybe I can fix File-Opener2
from cordova-plugin-file-opener2.
Related Issues (20)
- FileOpener2 error in electron 11 HOT 1
- Plugin is not handling Cookies in React project HOT 1
- Add documentation for error codes
- USB PORT PARAM HOT 1
- doesnt work with IOS and assets-library
- Usage in Capacitor HOT 1
- pdf opened in an external app cannot save changes HOT 1
- Cannot open file while is at app data location '/data/data/<app_id>/cache' HOT 2
- unable to open application/pdf format in Android device (Samsung Galaxy S21 and Samsung Galaxy S21+) HOT 2
- android.support.v4.content.FileProvider not found HOT 7
- Relative URIs are not supported.
- remove: android.permission.REQUEST_INSTALL_PACKAGES from plugins.xml HOT 85
- Text Open file in always localized in english (Android) HOT 4
- There was a problem parsing the package for android install apk HOT 1
- Can't edit file HOT 2
- Getting error after updating plugin to 4.0.0 on Android Studio HOT 2
- Unable to open some MP4 files on iOS? HOT 1
- This plugin has a maintained forked repo now - please use and follow HOT 4
- Error: Current working directory is not a Cordova-based project.
- iPadOS not supported
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-file-opener2.