Reputation: 21
I am using Ionic 2 for an app and I have a question regarding the ionic-native plugin - Camera. There any way to use the Camera only or photo gallery only inside of an Ionic 2 Application. using the option sourcetype CAMERA or PHOTOALBUM.
Is there a way where I can use both at the same time. Like in Whatsapp, when you want to send an image tou can take a picture at the same time or use a picture from photo gallery.
Any ideas?
Upvotes: 1
Views: 1770
Reputation: 1215
I think the best option is to show an action sheet (or something like that) in which the user can select an action (Camera or Album). Then create separate methods for both functionalities and call the desired method (this isn't a full implementation):
function getPictureFromCamera() {
Camera.getPicture({
...
sourceType: 'CAMERA'
}).then(...);
...
}
function getPictureFromAlbum() {
Camera.getPicture({
...
sourceType: 'PHOTOLIBRARY'
}).then(...);
...
}
Upvotes: 4