This is a migrated thread and some comments may be shown as answers.

plugin not working

14 Answers 223 Views
AppBuilder Windows client
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Roger
Top achievements
Rank 1
Roger asked on 29 Oct 2013, 11:56 PM
Hi,
downloaded fileopen plugin for Android here (https://github.com/markeeftb/FileOpener)..set it up per instructions for plugman compatible & doesn't work. 
Tried adding files to this post but every time I select attach files the page reloads and I lose everything (??). Fix this up & I'll add the 2 zip files.
Also added the line to index.html
<script type="text/javascript" src="Plugins/www/fileopener.js"></script>
and also tried
<script type="text/javascript" src="fileopener.js"></script>
but got a file not found error.

14 Answers, 1 is accepted

Sort by
0
Iva Koevska
Telerik team
answered on 30 Oct 2013, 06:56 AM
Hi Roger,

You can try using this fork of the plugin. It already has a valid plugin.xml and is updated to work against Cordova 3.0.0. Just add the plugin files to your project. You do not need to add <script> references to your index.html.

However, in plugin.xml, change line 15 to <clobbers target="plugins.fileOpener" /> Otherwise, the plugin does not work as expected.

Regards,
Iva Koevska
Telerik
You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Roger
Top achievements
Rank 1
answered on 30 Oct 2013, 11:37 PM
Hi Iva,
did as you suggested and installed everything.
Tried to run the plugin
window.plugins.fileOpener.open('file:///sdcard0/theFile.pdf')
and get windows.plugins undefined
Read that "plugins" has been depreciated  in 3.0 so ran
window.fileOpener.open('file:///sdcard0/theFile.pdf');
and get error Cannot call method 'open' of undefined

Something is going wrong...do you have a sample app that you can show me?
0
Iva Koevska
Telerik team
answered on 31 Oct 2013, 07:19 AM
Hi Roger,

Attached you can find a very basic example which opens an existing photograph on your sdcard. Just make sure that the file path to the image is correct. Check this documentation article as how to recreate a project from archive.

Here are a few suggestions that might help you identify your problem.

  • Do you have the cordova.js references in your index.html file? They should be on the top of your includes.
  • Do you initiate a deviceready event in your code? It should be the first thing your app does. Without it, you won't be able to run any Cordova functionality.
  • Are you testing on a physical device as custom plugins do not work in the simulator?

Basically, calling a custom plugin in Apache Cordova 3.0.0 goes down to calling whatever you have defined as clobbers target in the js-module declaration in the plugin.xml. For example, if the clobbers target is fileOpener, then you have to call the plugin with window.fileOpener. If the clobbers target is plugins.fileOpener, use window.plugins.fileOpener, and so on. You can read more about this here.

Regards,
Iva Koevska
Telerik
You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Roger
Top achievements
Rank 1
answered on 05 Nov 2013, 07:01 AM
Hi Iva,
thanks for that example....yes I had done all the things that you suggested but I thank you for sending the working example. I ended up deleting the test project completely and starting again...of course it works now...somewhere along the way I got something out of order but if I keep it simple it works fine.

Your example showed me the way...thanks again.

One question:

if I do fileSystem.root.name I get sdcard0...but the file is stored at file:///storage/sdcard0 & I use this path to successfully open my file...do I always have to add the "storage" to the file path?
0
Developer
Top achievements
Rank 1
answered on 20 Jan 2014, 03:56 PM
Hello.
How are you?
I have also trouble with custom plugin.
that is social sharing plugin.
I used https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin
I attached the my project.
sometime, I can see "nope" alert.
  if (typeof window.plugins.socialSharing !== 'undefined'){
      // plugin is available
    alert("okay!");
        window.plugins.socialSharing.share('Message and subject', 'The subject');
    }else{
    alert("nope!");
    }
Thanks.
0
Steve
Telerik team
answered on 21 Jan 2014, 04:24 PM
Hi,

We're not familiar with the SociaSharing custom Cordova plug-in and cannot be of much help for it. As the plugin is a 3rd party software, our suggestion is to contact the developer(s) of the plug-in directly in the Issues section of the github repo for more info and help on the issue you have faced.
Regards,
Steve
Telerik
You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Roger
Top achievements
Rank 1
answered on 03 Feb 2014, 12:10 AM
Hi again,
now I have the fileopener for Android (works a treat) is there a similar one for Apple...or is there a way to open files on an iPhone or iPad?
0
Roger
Top achievements
Rank 1
answered on 03 Feb 2014, 12:23 AM
Found the answer to my problem...Justin Wark has done an update on fileopener to include iOS in the same plugin !!!
Find it here https://github.com/jwark/FileOpener/tree/cordova-3.0
0
Roger
Top achievements
Rank 1
answered on 03 Feb 2014, 03:08 AM
No quite there..getting an assertion error  when it tries to open the file

*** Assertion failure in -[UIDocumentInteractionController setURL:], /SourceCache/UIKit/UIKit-2903.23/UIDocumentInteractionController.m:1010

this is the file path
/var/mobile/Applications/CAEAF24F-AFA6-48CA-B5BB-88FEBA383DD8/Documents/07f83cb8-07d2-44d8-82c3-be1b12dd1a80.pdf
0
Steve
Telerik team
answered on 03 Feb 2014, 08:22 AM
Hi Roger,

You do not necessarily need a plugin for iOS to open various types of files, take a look at this forum thread for more info and sample project.

Regards,
Steve
Telerik
Icenium is now Telerik AppBuilder, and is part of the Telerik Platform. For more information on the new name, and to learn more about the Platform, register for the free online keynote and webinar on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT)
0
Roger
Top achievements
Rank 1
answered on 04 Feb 2014, 01:59 AM
Hi Steve,
tried out your example and it won't work on Android (Galaxy S3 V4.2) !!!! Works on iPad though.
Tried changing the window.open(path, '_system'); to window.open(path, '_blank); & get a "Wepage not available" error.
The original path is file:///storage/emulated/0/sample.pdf but the webpage comes up with 
file:///storage/emulated/0/icenium/com.telerik.DocumentOpener/undefined.
The original _system command gives nothing...like dissapears into a black hole...could use this method with the Android plugin to cover apple though
BTW I created a new app from the zip file & didn't just add bits to my original app.
0
Steve
Telerik team
answered on 06 Feb 2014, 03:36 PM
Hi Roger,

I've tested on several Android devices including Galaxy S3 with Android 4.1.2 and the sample works on all of them. For Android, you should use _system and not _blank or _self.

Regards,
Steve
Telerik
Icenium is now Telerik AppBuilder, and is part of the Telerik Platform. For more information on the new name, and to learn more about the Platform, register for the free online keynote and webinar on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT)
0
Roger
Top achievements
Rank 1
answered on 10 Feb 2014, 04:37 AM
Hi Steve,
glad it's working for you but it isn't for me...am using _system and activity just stops at this line...I don't know why and everything else is working.
The Android plugin for file opener is working and I don't have the time to try and find out why it fails on Android (it does fine on Apple) so I'll stick with the Android plugin.
I am finding more and more with the hybrid/cordova scene that it depends how high you're holding your leg when you type the code in rather than what you're actually typing...there is so much going on with frameworks,plugins, callbacks etc that getting something to work is more a happy accident than a science.

thanks for your help in getting the Apple side of things to work
0
Steve
Telerik team
answered on 11 Feb 2014, 03:04 PM
Hello Roger,

If you have the time, you could debug on device to see what goes wrong, see Debug on Android Device.
If that does not help you can setup Fiddler to log the device traffic, which would give you a clue what's going on if the problem is failing/wrong requests/responses.

Regards,
Steve
Telerik
Icenium is now Telerik AppBuilder, and is part of the Telerik Platform. For more information on the new name, and to learn more about the Platform, register for the free online keynote and webinar on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT)
Tags
AppBuilder Windows client
Asked by
Roger
Top achievements
Rank 1
Answers by
Iva Koevska
Telerik team
Roger
Top achievements
Rank 1
Developer
Top achievements
Rank 1
Steve
Telerik team
Share this question
or