Closed aatmmr closed 2 weeks ago
👋 @aatmmr
NOTE: This comment is auto-generated.
Are you sure you have already searched for the same problem?
Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!
If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.
In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE]
or ios WKWebView [MY ERROR HERE]
keywords.
Following these steps can save you, me, and other people a lot of time, thanks!
I also can't get motion events to work for a page server from a local file. But I think this is related to InAppWebView
and not InAppLocalHostServer
.
There is this https://bugs.webkit.org/show_bug.cgi?id=203287 saying that the WKUIDelegate
needs to be set, but I think it is set.
There are also these new delegate methods for iOS 15: https://developer.apple.com/documentation/webkit/wkuidelegate?changes=latest_minor&language=objc
Hacking this into InAppWebView.swift
:
@available(iOS 15.0, *)
public func webView(_ webView: WKWebView,
requestDeviceOrientationAndMotionPermissionFor origin: WKSecurityOrigin,
initiatedByFrame frame: WKFrameInfo,
decisionHandler: @escaping (WKPermissionDecision) -> Void) {
decisionHandler(.grant)
}
And combining it with some javascript after user interaction seems to work:
DeviceMotionEvent.requestPermission().then(response => {
console.log(response)
}).catch(console.error);
Just need some way to remember this permission. Currently I need to grant it again every time the app is started.
I added a PR which allows to support this on iOS 15+. I have not found a way to do this for older versions (13/14).
This issue is stale and has been automatically closed because it has been open for more than 365 days with no activity. Please reopen a new issue if you still have it.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.
First of all, thank you for creating this package which is highly useful and flexible.
We would like to run a simple HTML5 game in the WebView which is loaded via
InAppLocalHostServer
. The game uses motion sensors as user controls which works prior to iOS 14 without any issues. Since iOS 14, the user must consent the sensor usage. Usingpermission_handler
requesting the constent works but does not apply to the game running on the localhost. If we add a separate permission request to the game itself, an alert will show up asking:"localhost" Would Like To Access Motion and Orientation.
Giving consent to the usage will make the game work - so far so good.
However, for a better UX, is it possible to:
Or am I missing something?
The app runs on package version
5.3.0
and flutterstable
branch.