facebook

How to use Camera and filesystem api’s in Mobi One?

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #345746 Reply

    rick.gommers
    Member

    Hi all,

    I’m new to Mobi One and it’s not clear for me how to use the Camera’s and Filesystem api in Mobi One.

    I have 2 buttons, one for users to make their own picture, and one for users to select a picture from their gallery. Is it possible to put the functions to these buttons using the designer interface from Mobi One?

    Thx in advance!

    #345777 Reply

    Brandon
    Member

    Check out the PhoneGap API it has all you need to get an image from the camera or library:
    http://docs.phonegap.com/en/3.3.0/cordova_camera_camera.md.html#camera.getPicture

    #345805 Reply

    rick.gommers
    Member

    Thx a lot CincyPlanet! I bet it’s not possible then to use the camera with MobiOne designer application? At least I know how to do it in code now 🙂

    #345821 Reply

    Brandon
    Member

    No, there is no camera widget or anything like that, but its pretty easy to implement.

    #346533 Reply

    rick.gommers
    Member

    Working on this now.

    I don’t like the result at all. Implementing capture api results in a ugly select box when I click on my camera button in the simulator:

    How can I style this? Ideally I want something like this for iOS:

    #346551 Reply

    Brandon
    Member

    On the device it will be different, like any other app that selects an image or takes a photo.
    If Im not mistaken you cant style the iOS one.

    #346566 Reply

    @marcoevich,

    This gives you an option to select an image from file system to simulate returning pic data through the sim api.

    #346581 Reply

    rick.gommers
    Member

    Edit: wait wait wait,

    Fortunately Mobi one is crossplatform, so I can test on my Android device 🙂

    What I see is that My code works, but it displays a selection box to select image from gallery.

    What I want is to first make the choice between gallery and camera. A combination of capturePhoto and getImage

    Would that be possible with only one button? Like in the screenshot above? Basically I’m using the full example of the camera.getPicture found here: http://cordova.apache.org/docs/en/2.9.0/cordova_camera_camera.md.html

    #346614 Reply

    Brandon
    Member

    In my experience for iOS you have to do one or the other, but you could make either a new screen with the button choices or even just a simple hidden panel with the two buttons that show when you want them to chose from taking a photo or fromt he gallery.

    I am working on a Multiplayer Bingo game that can use photos and since I use the camera there is no way I can see, from the camera screen to change to selecting from the gallery.

    #346621 Reply

    rick.gommers
    Member

    Good to know. I’ll try to find a solution for it. A hidden tab panel would be a good idea to begin with 🙂 I’ll report here once I’ve solved that.

    If you come across any method of presenting both functions in one screen, then let us know 🙂

    #346626 Reply

    Code_A
    Member

    What about adding a popup confirmation dialog box with button options when the user pushes your ‘Select an Image’ button? Kind of like the ‘Rate it now, Remind me later, Cancel’ popups you see in many apps.

    // Show a custom confirmation dialog
     navigator.notification.confirm(
        'Add a Picture',                               // message
         onConfirm,                                  // callback to invoke with index of button pressed
         'Select a Picture to Add.',                 // title
         'Choose Existing...,Take a Picture,Cancel'            // buttonLabels
    );
    
    // process the confirmation dialog result
    function onConfirm(button) {
        alert('You selected button ' + button);
        //add code to handle buttons here
    }
    #346631 Reply

    rick.gommers
    Member

    Looks good 🙂 Thx Code A!

    When I finish my function on the multi tab page, I’ll look into this.

    #347298 Reply

    rick.gommers
    Member

    Hahah. The code above works perfectly on device. Whoever designed how this should look in the simulator is a genius 😀

    #347357 Reply

    Hi marcoevich,

    The “I Haz Cheeseburger?!?!?!” message is a goofy bug in the simulator that we are working on.

    #347433 Reply

    rick.gommers
    Member

    Hi Octavio,

    in that case could you make the layout of this I can has cheezburger screen more similar to what it looks like on a real phone? For example, use the real buttons and their real textvalues instead of these random ones

Viewing 15 posts - 1 through 15 (of 16 total)
Reply To: How to use Camera and filesystem api’s in Mobi One?

You must be logged in to post in the forum log in