Software Archive
Read-only legacy content
17061 Discussions

List all photos in the native camera roll with intel xdk

Jim_A_1
Beginner
528 Views

Hi Everyone,
I am new to the forums and the intel xdk. I am wondering if it is possible to list all photos in the native camera roll with intel xdk (or with Cordova/ jQuery)?
I have searched on Google and on this forum. I cannot find a way to do this simple task.
I also read the intel xdk doc. and saw that intel.xdk.camera.getPictureList.length should return me the number of photos in my camera, but I always get a zero both via the Intel App Preview and the installed apk on my android phone. No error was reported in the xdk. I have more than 20 photos in my phone.
Any suggestions will be greatly appreciated. This task seems to be a very basic file listing type of task, but I have spent days to figure this out, this is very disappointing.
Thanks guys,
Jim.

0 Kudos
10 Replies
Elroy_A_Intel
Employee
528 Views

With the latest release of Intel XDK v. 1199, I recommend that you use a Cordova plugin called Image Picker that allows you to select multiple images. You can find more information about this plugin at https://github.com/wymsee/cordova-imagePicker. You can include them in your project under the PROJECTS Tab. 

Note: You will only be able to test the Cordova plugin in a Built app created under the BUILD tab.

0 Kudos
Maurizio_B_
Beginner
528 Views

What would be really useful, however, would be to get a simple list of the device's photos URLs. Quite a basic task, in my opinion.

Instead, ImagePicker shows a (nice) "dialog" to let the user choose one or more pictures, and in a lot of cases this is unnecessary if not even obtrusive, e.g. if one has to build a sort of slideshow on the device's internal pictures.

intel.xdk.camera.getPictureList would seem perfect for the goal. The problem is that, as you say, it isn't working. Please, at least mark it as faulty or deprecated in the documentation, just to avoid wasting so much time in trials and error.

Thanks

Maurizio

0 Kudos
Azouz_Z_
Beginner
528 Views

Is  intel.xdk.camera.getPictureList working now ?

0 Kudos
PaulF_IntelCorp
Employee
528 Views

The intel.xdk namespace plugins are being deprecated. In most cases there are better alternatives available from the Cordova community. Please consider the options that Elroy mentioned in an earlier post or search for "cordova phonegap plugins camera" for additional alternatives. The existing intel.xdk plugins have been open sourced and are available here: https://software.intel.com/en-us/xdk/docs/intel-xdk-api-cordova-plugin-methods-properties-events

0 Kudos
Azouz_Z_
Beginner
528 Views

Do you have an example code using cordova-imagePicker ?

0 Kudos
Azouz_Z_
Beginner
528 Views

Hello,

I create a simple page with one button on the bootstrap framework using the app designer.

I modified the file index_user_scripts.js to insert the code lines (nearly the code fromhttps://github.com/wymsee/cordova-imagePicker) by adding just one function call:

        /* your code goes here */

        window.imagePicker.getPictures(
            function(results) { alert("Good")},
            function (error) { alert('Error: ' + error);}
        );

In the emulator, i have a box window whose title is : "Missing Api Emulation". I think this message was refered by Elroy in his reply.

So, i follow Elroy's recommendation and  go to the test tab.

I start the app on my iphone. Nothing happened when i touch the button.

Do i have to do or include something else ?

Regards

0 Kudos
PaulF_IntelCorp
Employee
528 Views

That plugin is not one of the "core" Cordova plugins. Only the core plugins are part of App Preview, which is what the Test tab uses to run your app. It does not have access to any third-party plugins. Please see these doc pages:

0 Kudos
Azouz_Z_
Beginner
528 Views

Thank you Paul, for the infos and the link.

i downloaded "hello-cordova", "blank-xdk-cordova" and "test-third-party-plugin". I see them as a training. I do not think i miss a step in my own app.

So how can i test my app using "non-core" cordova plugin in xdk ? i have to push them directly on google play or app store  for testing them ?

Regards

0 Kudos
PaulF_IntelCorp
Employee
528 Views

To test an app today, that includes a third-party plugin, you need to build that app and test it on your device. There is no need to push it to the store for testing. The easiest system for doing this is Android. See this doc page: https://software.intel.com/en-us/xdk/docs/intel-xdk-debug-and-test-overview#RemoteChromeDevTools

When you build an app you can email it to your device and install it that way (this works very well with Android and iOS).

We will be releasing a test version of the XDK that will make this process easier, but it is not yet available. In the meantime, the procedure outlined in the above link is the best option.

0 Kudos
Roman_V_1
Beginner
528 Views

I'm working on cordova-plugin-photo-library plugin which provides cross-platform way to enumerate through all photos on device.

 

0 Kudos
Reply