Callback a picture in Cordova custom Plugin - android

I am trying to make a custom plugin for Cordova that will be used for Android. Now, in the src code of the plugin for Android, I have a drawable (icon) which I want to pass it to the Cordova side (The plugin returns a name and its drawable).
So far, the best idea that I could find was to save the image in a temporary folder and give the path back to cordova side. However, since it is never a big picture has anyone any other suggestions to give the drawable as a callback to Javascript side?
Thanks all

Someone contributed to the plugin for Cordova I have wrote, and added this functionality. But the way it was implemented was saving the image to sd card in the plugin and reading it from cordova.
You can check it at https://github.com/jmrezayi2/Applist

Related

Read video file with cordova in android

Currently I am working on an Ionic Cordova app which let an user upload vdo and image from android device. I finished working image upload with help of cordova camera plugin which can choose photo from user phone and return base64 data. Now i am trying to get video as i did for image. But the video return data is file url which is sth like this content://com.android.providers.media.documents/document/video%3A27227 . I don't know how to continue .
Appreciate your help
You can use that url and pass it to a fileHandler routine and read the contents of the video.
I will forewarn you that it gets very complicated with iOS and Android using different file url formats. And there's no consistency between various Android devices that I ended up using a 3rd party plugin from the Ionic market place which is worth every penny and saved me months of development time and aggravation.

Retrieve images from sdcard of Android emulator in Ionic Framework

I run my app in Ionic Framework using ionic run android.
What I need is to retrieve all the images in the sdcard of emulator and display it in my view.
I tried using camera.getPicture(), but in that function, a list of images in sdcard will be displayed first and from that list, I have to select the images that I need.
But what my requirement is that, I want all the photos from the sdcard to be displayed directly in my view. Is there any function to make it possible?
You cannot do this by using ionic framework only. Cordova is used to do this action which you need. following link may be helpful for you. :)

phoneGap: select audio file from device and upload

I am new to phoneGap. I am creating a dummy app to upload an audio file from iOS/android device on local server. So I was wondering if there is a way to open the audio gallery and select the required audio file to upload. Similar to an image gallery.
Is it possible to open audio list and select necessary audio file? If not, what is the alternative?
As far as I remember, you cannot reach the pictures and audio files stored in the media gallery. Therefore, you may need to implement your own native plugin and call the appropriate methods from your JavaScript code.
You can capture audio/image by using Capture plugin of Phonegap. Check this out Capture Plugin
You can perform basic File operations as well. Check this out File Plugin
For your situation, you have to implement native interface which can be accessed by your JavaScript code. This would be an alternative way for it. If you desire to create your own plugin, please have a look at Plugin Development Guide. This might be helpful.
Well I have implemented code using file plugin which will iterate through all the folders recursively to find all the image (created this as I needed multi selection approach which is not directly provided by cordova) . You can modify the extension of image (search) i.e png,jpeg etc with audio extension.
With this code you will get the path of audio files and you can make use of filetransfer to upload it on server
Hope it helps you

fileentry.delete succeds on Cordorva (PhoneGap) however the photo is still in the photo library

I have the following code to remove a file on a PhoneGap / Cordova Project:
window.resolveLocalFileSystemURI(fileUrl, function(entry) {
entry.remove(that._onFileDeleteSuccess, that._onFileDeleteErrorError);
}, that._onFileDeleteErrorError);
The code executes file and the _onFileDeleteSuccess callback is fired.
However when I go to look in the Photo Library on the iPhone, the file is still there.
In addition to this, if I then capture another file, the new file name seems to be the same as the old one, and you even see the old file if you bind the URL of an img element to the newly captured path.
Any ideas? It's as if the app thinks the file has been deleted, but the OS is not actually removing the file.
Turns out the problem is just in Icenium ION on iPhone... once the app was built with provision, all seems to work as expected now.

How to download text file and read it using a phonegap for android

Hi how do we download text files using phonegap framework .can we use javascript or do we phone gap apis for it? I tried to look into phone gap documentation but couldn't find anything regarding downloading of files.Please help.
Thanks.
You want to use the File API, specifically the FileTransfer object: http://docs.phonegap.com/en/1.5.0/phonegap_file_file.md.html#FileTransfer

Categories

Resources