0

I want to browse for and upload a file to a server using phonegap.

The problem is, that on my phone (droid) once I select a file and the focus returns to my app, it reloads as if I just opened it. I'm using build.phongap.com and my build for ios works on my friends iphone 5, and the apk that fails for me is working on a friend's galexy S.

I've tried the standard html input field '' as well as

a button that calles the following function:

        jQuery('#find_file').click(function(){
            alert("prebrowse");
            this.photoDestinationType=navigator.camera.DestinationType;
            var source =  navigator.camera.PictureSourceType.PHOTOLIBRARY;
            navigator.camera.getPicture(successFn, errorFn, { quality: 50,
                    destinationType: this.photoDestinationType.FILE_URI,
                    sourceType: source,
                    mediaType: navigator.camera.MediaType.ALLMEDIA  });
            alert("postbrowse");
        });

Both with the same results. They both work on iphone and galexy S but on my droid my app reloads when focus returns to it. How can I keep this from happening? when I browse for attachments from the facebook app or gmail app it works fine.

benino
  • 577
  • 2
  • 6
  • 16
  • In the AndroidManifest.xml, what is the android:launchMode for the activity? – Uncharted Space Dec 10 '13 at 18:53
  • All my config options are in config.xml since I'm using build.phonegap.com to compile the app. When I open the built apk file in winrar and extract the AndroidManifest.xml file that gets generated for me in a text editor, it's all unreadable characters. – benino Dec 12 '13 at 01:29
  • I'm not familiar with phonegap build, but here's what I would do: first I would check if the whole activity is getting recreated which would cause the PG app to reload. To check this just put a log statement or something in your onCreate method in your .java file. If the log is fired when returning to the screen after a file selection, you know the activity is being re-created. – Uncharted Space Dec 12 '13 at 15:12

0 Answers0