Cap-go / capacitor-inappbrowser

Capacitor plugin in app browser with urlChangeEvent
MIT License
58 stars 38 forks source link

Dosen't work on Android #29

Closed rdiegoss closed 6 months ago

rdiegoss commented 1 year ago

Hello everyone, I'm using the Browser.open and Browser.openWebView method to open a web page and I need that when I change the URL I can get the value of the modified URL.

In IOS the command browser.open and adding the browser.addListener('urlChangedEvent', callback) works perfectly, however in Android, it does not work. It simply doesn't detect the URL change.

I tried using browser.openWebView, it detects when I open the web page, but it doesn't detect when the URL changes. using the same browser.addListener('urlChangedEvent', callback) event. Could you help me with this, please?

riderx commented 1 year ago

Hello @rdiegoss i do have this plugin in use in some apps and that have work until now, can you provide a reproduction repo, that will allow me to fix your issue in 5 min i'm sure !

cyrilfr commented 1 year ago

I have the exact same issue after a fresh install. I'm building for SDK 32 with version 33 and I'm testing on Android 13. Maybe the feature is broken by the new SDK versions?

cyrilfr commented 1 year ago

I've been able to get urlChangeEvent working only by using openWebView(). open() opens a standard browser that doesn't support this kind of event.

atsavos commented 1 year ago

Hello by using openWebView does not promt me to give permissions to open camera. by using .open() i am able to open camera. Is there a way to make it work on .openwebview too? thanks

riderx commented 1 year ago

@atsavos i'm not sure why that doesn't work with openWebView maybe the webview has different rules. You can try to request the permission before open the webview.

riderx commented 7 months ago

Hey @atsavos i think i found why the camera was not prompting, can you look again with the latest version ?

atsavos commented 7 months ago

Hello @riderx thank you for your response. I will check it and report back the results.

atsavos commented 7 months ago

Hello again @riderx , I have tried it with ios and android. on ios asks for camera permission and i can use it but on android still don't ask me for permission and i cannot use the camera. I saw your change and may i suggest if you should give permission for camera in webview settings?

riderx commented 7 months ago

@atsavos can you try to add this permission in the android manifest:

    <uses-permission android:name="android.webkit.PermissionRequest" />

This should allow the webview to ask

atsavos commented 7 months ago

@atsavos can you try to add this permission in the android manifest:

  <uses-permission android:name="android.webkit.PermissionRequest" />

This should allow the webview to ask

I tried your suggestion @riderx but no luck. I can see the page but no prompt for camera permission. A small reminder that i user .openWebView as i need the urlChangeEvent. on .open works the prompt for camera but not the event.

riderx commented 7 months ago

i did used openWebView in my test as well, did you removed the app from the phone before trying ?

riderx commented 7 months ago

Ok depending of the Android phone the error wasn't the same ! I make a new change in 1.2.19 this was way harder to do : "android.webkit.PermissionRequest" seem not required anymore.

atsavos commented 7 months ago

Thank you for your reply @riderx. I will test it again and i will return with my feedback