Invalid Photo Path when deployed thru Ionic Pro/View


#1

I have a takePhoto function that captures a photo and displays it in my view and it works exactly as expected when I deploy directly to my test device. I deploy thru Ionic Pro and my testers view the app in Ionic View and the photos show as broken images. I’m not seeing any errors and the only difference I can find is in the file path.
Local deploy:
file:///storage/emulated/0/Android/data/io.ionic.starter/cache/image.jpg
Ionic View:
file:///storage/emulated/0/Android/data/com.ionicframework.view/cache/image.jpg

Using Ionic 3, is there some work-around to fix the file path for Ionic View so my testers can test?
I found the saveToPhotoAlbum option which does save the photo, but I can’t find a way to directly reference the photo that was just taken. Any guidance or suggestions would be greatly appreciated.

image


#2

It’s not possible with any good method because Ionic View does not include the cordova-plugin-file: https://ionicframework.com/docs/pro/view.html#plugin-support

Therefore you cannot load anything with a file:/// path. You could workaround this by using a base64 string of the image instead of the file uri, but this is not recommended and could crash your app. However…if you have to use Ionic View you don’t really have any other choice as far as I know.

You could use a base64 version in Ionic View but a file uri in production?


#3

Thanks for the help.
I found an acceptable work-around - not using Ionic View.
Sharing in case it helps someone else…

I created a new build after running this:

cordova plugin add cordova-plugin-ionic --save
–variable APP_ID=“xxxxxxxx”
–variable CHANNEL_NAME=“AnyChannel”
–variable UPDATE_METHOD=“auto”

I emailed the resulting apk to my test device and installed manually allowing installation from unknown sources.
Each time I push an update, I commit my changes and push to ionic master assigning to my dev channel.
Relaunch the app and my update loads - and the broken image issue is solved.

This problem seems to be with Ionic View as Pro can still generate a working build with the unsupported plugins.