dawi
dawi

Reputation: 628

Share photo from android gallery "share button" with Phonegap

When a user click on my icon share, in the android gallery, I want to resume the phonegap browser and notify javascript with the file path.

For the moment, I've added this in my manifest :

<action android:name="android.intent.action.SEND" />

But the problem is that a new activity is created, which do the loadUrl. What is the good way to restore the latest activity/page ?

Upvotes: 3

Views: 430

Answers (1)

Antoine
Antoine

Reputation: 558

Maybe you could use this feature implemented by Phonegap to make the user selecting a file and retrieve it's path : http://docs.phonegap.com/en/2.5.0/cordova_camera_camera.md.html#Camera

This feature allows you to retrieve a photo from the device's album. The image is returned as a base64 encoded String or as the URI of an image file (what you want).

Look at the camera.getPicture section and the Camera.PictureSourceType.PHOTOLIBRARY option.

Use Camera.DestinationType.DATA_URL as destination type to retrieve the path of the image.

Hope this helps ! Bye !

Upvotes: 1

Related Questions