The following code opens up the in app browser in iOS and shows the PDF file.
Uri resumeUrl = Uri.https(
storageBaseUrl,
'$storageBucketUrl/${filePath}',
);
if (await canLaunchUrl(resumeUrl)) {
launchUrl(resumeUrl
}
However in case of Android. A white screen is being shown
I tried LaunchMode.externalApplication but that takes the user to chrome and downloads the PDF which is not the experience I'm looking for. I would like to have the same behaviour as iOS in Android as well.
Have also added all the required android:scheme to the manifest file.
Tried with both enableJavaScript : true and enableJavaScript : false
Also tried adding
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
to manifest file and it still doesn't work.
Some of the logs I noticed in console on opening the url(PDF Resource on GCP).
/UrlLauncher(24742): component name for https://storage.googleapis.com/files/FAKE_FILE.pdf is {com.android.chrome/com.google.android.apps.chrome.IntentDispatcher}
I/ViewRootImpl@67ff2f9[MainActivity](24742): MSG_WINDOW_FOCUS_CHANGED 0 1
D/InputTransport(24742): Input channel destroyed: 'ClientS', fd=128
I/ViewRootImpl@67ff2f9[MainActivity](24742): handleAppVisibility mAppVisible=true visible=false
I/SurfaceView@901753(24742): onWindowVisibilityChanged(8) false io.flutter.embedding.android.FlutterSurfaceView{901753 V.E...... ........ 0,0-1080,2274} of ViewRootImpl@67ff2f9[MainActivity]
I/SurfaceView@901753(24742): pST: mTmpTransaction.apply, mTmpTransaction = android.view.SurfaceControl$Transaction@9262987
I/SurfaceView@901753(24742): surfaceDestroyed callback.size 1 #2 io.flutter.embedding.android.FlutterSurfaceView{901753 V.E...... ........ 0,0-1080,2274}
I/SurfaceView@901753(24742): updateSurface: mVisible = false mSurface.isValid() = true
I/SurfaceView@901753(24742): tryReleaseSurfaces: set mRtReleaseSurfaces = true
I/SurfaceView@901753(24742): 96460965 wPL, frameNr = 0
I/SurfaceView@901753(24742): remove() from RT android.view.SurfaceView$SurfaceViewPositionUpdateListener@5bfe0a5 Surface(name=SurfaceView - com.pyjamahr.pyjamahr/com.pyjamahr.pyjamahr.MainActivity@901753@3)/@0xdc31c7a
I/SurfaceView@901753(24742): remove() io.flutter.embedding.android.FlutterSurfaceView{901753 V.E...... ........ 0,0-1080,2274} Surface(name=SurfaceView - com.pyjamahr.pyjamahr/com.pyjamahr.pyjamahr.MainActivity@901753@3)/@0xdc31c7a
I/SurfaceView@901753(24742): aOrMT: uB = true t = android.view.SurfaceControl$Transaction@8c1a60 fN = 0 android.view.SurfaceView.access$500:124 android.view.SurfaceView$SurfaceViewPositionUpdateListener.positionLost:1785 android.graphics.RenderNode$CompositePositionUpdateListener.positionLost:326
I/SurfaceView@901753(24742): aOrMT: vR.mWNT, vR = ViewRootImpl@67ff2f9[MainActivity]
I/ViewRootImpl@67ff2f9[MainActivity](24742): mWNT: t = android.view.SurfaceControl$Transaction@8c1a60 fN = 0 android.view.SurfaceView.applyOrMergeTransaction:1628 android.view.SurfaceView.access$500:124 android.view.SurfaceView$SurfaceViewPositionUpdateListener.positionLost:1785
I/ViewRootImpl@67ff2f9[MainActivity](24742): mWNT: merge t to BBQ
D/OpenGLRenderer(24742): setSurface called with nullptr
D/OpenGLRenderer(24742): setSurface() destroyed EGLSurface
D/OpenGLRenderer(24742): destroyEglSurface
I/ViewRootImpl@302c854[MainActivity](31905): Relayout returned: old=(0,0,1080,2400) new=(0,0,1080,2400) req=(1080,2400)8 dur=4 res=0x5 s={false 0} ch=true fn=2
I/SurfaceView@901753(31905): windowStopped(true) false io.flutter.embedding.android.FlutterSurfaceView{901753 V.E...... ........ 0,0-1080,2274} of ViewRootImpl@302c854[MainActivity]
2
D/SurfaceView@901753(31905): updateSurface: surface is not valid
I/ViewRootImpl@302c854[MainActivity](31905): stopped(true) old=false
D/SurfaceView@901753(31905): updateSurface: surface is not valid