Open file in another app

4 posts, 1 answers
  1. Paul
    Paul avatar
    113 posts
    Member since:
    May 2009

    Posted 22 Jul 2013 Link to this post

    Hi,
      1.  Is there a way in which I can do the following, once I have downloaded a file to the local application storage (I know how to do this),  Then click a button that will popup the menu showing other apps that file can be opened in?

    To basically do the following and having A menu prompting the user only to open it using another app.http://developer.apple.com/library/ios/#documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/PreviewingandOpeningItems.html#//apple_ref/doc/uid/TP40010410-SW1

    2. Also how can I once I have downloaded an image save it to the photo library. I have seen some posts here where people have asked it but no real answer on if it can be done. Most of your responses are about how to download a file but nothing about how to save it the phones photo library so that it will show up in the gallery.

    Thanks
    Paul
  2. Paul
    Paul avatar
    113 posts
    Member since:
    May 2009

    Posted 22 Jul 2013 Link to this post

    Ok I have managed to achieve open in another app by creating a custom plugin which works really well. All I do now is pass the url and the file type to the plugin and IOS will download the file and popup a menu showing all the apps installed that have that file type associated with them.

    So still need 2 answering or is that only possible via a custom plugin too?
  3. Answer
    Steve
    Admin
    Steve avatar
    10941 posts

    Posted 23 Jul 2013 Link to this post

    Hello Paul,

    There is already an existing plug-in for #1: ExternalFileUtil.

    About your second question, there is currently no Cordova support for saving existing images to photo gallery. You would have to use a plug-in for this purpose, here is one https://github.com/grnadav/SaveToPhotoAlbumPhonegapPlugin.

    You can find more information on Custom plug-in in Icenium in the following links:


    Regards,
    Steve
    Telerik

    Do you enjoy Icenium? Vote for it as your favorite new product here (use short code H048S).
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  4. Paul
    Paul avatar
    113 posts
    Member since:
    May 2009

    Posted 23 Jul 2013 Link to this post

    Hi Steve,
                   Yeah I used ExternalFileUtil and slightly modified it a little so all I had to do is pass in filepath and file extension instead of having to pass in the uti. So I made this change which will automatically lookup the correct uti based on what ever extension is passed in. for instance png will map to public.png saves me having to know all the uti's.
        NSString *uti = (NSString *)UTTypeCreatePreferredIdentifierForTag(
                                  kUTTagClassFilenameExtension,
                               (CFStringRef)[arguments objectAtIndex:1], NULL);

    I will take a look at SaveToPhotoAlbumPhonegapPlugin, so thank for pointing me in that direction.

    I have to say I love the fact you can edit these .h and .m files directly in icenium, the icing on the cake would be intellisense for these types of files too but can live without it.

    Thanks
Back to Top