Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8987197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:43:53+00:00 2026-06-15T21:43:53+00:00

EDIT: For those who are seeing this now, we’ve since solved the problem. See

  • 0

EDIT:

For those who are seeing this now, we’ve since solved the problem. See my answers to this question and this question for an explanation and possible solution.

Alright, I thought I had this figured out, but I didn’t.

What’s happening is the usual with starting the camera in Android: once you take the picture, the memory requirements cause the system to kill the app that started the camera. My difficulty is that I can’t get a hold of the URI for the recently captured image after my app gets killed. I’ve seen a lot of solutions for this for native Android apps in my searching, but nothing for Phonegap.

This is further complicated by the fact that the page that the camera is starting from is not the page that the activity loads into by default. When the app restarts, it wants to restart in the login page of this app, instead of the page that needs the URI of the image data.

I got the app to save the last page it was on before it dies, and recall that when it starts. I thought that this would fix the problem, but the camera’s callback still doesn’t get called. This is probably because even though it’s returning to the same page, it’s returning to a different instance of that page.

Let me show you what I have so far.

This is the code that calls the camera:

    function capturePhoto(){
        navigator.camera.getPicture(onPhotoURISuccess, onFail,
            { quality: 20, destinationType: Camera.DestinationType.FILE_URI } );
    };

    function onPhotoURISuccess(imageURI) {
        //Do some stuff with the image, like save the URI in localStorage
    }

Pretty basic, there’s nothing special there. It’s just that onPhotoURISuccess() never gets called. Here’s how I save and reload the the last page. It’s all done in Java in the DroidGap activity:

    //Save the last page that the user was on
    @Override
    public void onSaveInstanceState(Bundle savedState) {
        super.onSaveInstanceState(savedState);

        savedState.putString("lastPage", appView.getUrl());
    }

    //Recall the page
    @Override
    public void onCreate(Bundle savedState) {
        super.onCreate(savedState);

        //The default page is the login page
        String pageToLoad = "file:///android_asset/www/login.html";

        if(savedState != null && savedState.containsKey("lastPage")) {
            pageToLoad = savedState.getString("lastPage");
        }

        super.loadUrl(pageToLoad);
    }

So, my thoughts so far have been to somehow get the onActivityResult from the camera in the DroidGap activity, but I’m not sure how that would work, and I would rather not create a Phonegap plugin for it because I’d like to keep the code as cross-platform as possible.

The other thought is to somehow tell the camera where to save the picture, relative to the application’s directory, from Phonegap. Then, the page that needs the picture could just grab whichever photo is in the specified directory. However, I haven’t been able to find a way to do this.

Sorry if I overlooked something in my searches and this is a repeat question, and thanks in advance for your help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:43:55+00:00Added an answer on June 15, 2026 at 9:43 pm

    For those who are seeing this now, we’ve since solved the problem. See my answers to this question and this question for an explanation and possible solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: for those who come here with a similar problem, now i know this
My current solution will suck sometimes EDIT For those who don't understand,see this example:
EDIT: I've been convinced that this question is somewhat non-sensical. Thanks to those who
Possible Duplicate: C# 'var' keyword versus explicitly defined variables EDIT: For those who are
EDIT: had to retag this, because, it's rather a Sweave / R question since
EDIT 07/14 As Bill Burgess mentionned in a comment of his answer, this question
Edit: To those who need to blit an image(i.e. copy a part of a
EDIT #3 : Microsoft has released a 'fix' to this problem which is available
Most likely it's a dumb question for those who knows the answer, but I'm
EDIT: This question title originally was: How does Doctrine know last inserted id in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.