Closed yang5664 closed 4 years ago
androidOnGeolocationPermissionsShowPrompt:
(InAppWebViewController controller, String origin) async {
return GeolocationPermissionShowPromptResponse(
origin: origin,
allow: true,
retain: true
);
},
Hi @yang5664 yang5664. I tried androidOnGeolocationPermissionsShowPrompt
in my code. But it only worked on debug mode. After i create release of the app, cannot access location anymore. Any suggestion to fix that?
Hi @yang5664 yang5664. I tried
androidOnGeolocationPermissionsShowPrompt
in my code. But it only worked on debug mode. After i create release of the app, cannot access location anymore. Any suggestion to fix that?
Thank you @Xuan-Goldenf for your quick reply! You just saved me. Thanks again
Hi @yang5664. I tried androidOnGeolocationPermissionsShowPrompt in my code. But it is not worked for me. I put a debug point inside the method but it seems the method not firing. I updated the AndroidManifest.xml correctly. Any suggestion to fix that?
androidOnGeolocationPermissionsShowPrompt: (InAppWebViewController controller, String origin) async { return GeolocationPermissionShowPromptResponse( origin: origin, allow: true, retain: true ); },
I did the same and also added in AndroidManifest.xml but it is not working, doesn't even fire the event
androidOnGeolocationPermissionsShowPrompt: (InAppWebViewController controller, String origin) async { return GeolocationPermissionShowPromptResponse( origin: origin, allow: true, retain: true ); },
I did the same and also added in AndroidManifest.xml but it is not working, doesn't even fire the event
I got it working I added geolocator: ^6.2.0 in pubspec.yaml and run that package in initState as LocationPermission permission = await Geolocator.checkPermission(); await Geolocator.requestPermission(); await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
then passed in the inappwebview using androidOnGeolocationPermissionsShowPrompt: which worked as a charm
then passed in the inappwebview using androidOnGeolocationPermissionsShowPrompt:
How did you do this? do you have an example?
Hi, can someone share full example code for this geolocation added and cookies implemented please?
Why I cannot find anywhere, even for the cookies. so sad!!!!
I got it working for geo now, but cookies and openlink using ShoulOverloadingURL seems have little glitch! :-(
Little said.... its broken for url scheme :-(
import 'dart:async'; import 'dart:collection'; import 'dart:convert'; import 'dart:io'; import 'dart:typed_data'; import 'package:flutter/material.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:url_launcher/url_launcher.dart';
Future main() async { WidgetsFlutterBinding.ensureInitialized();
if (Platform.isAndroid) { await AndroidInAppWebViewController.setWebContentsDebuggingEnabled(true); }
runApp(new MyApp()); }
class MyApp extends StatefulWidget { @override _MyAppState createState() => new _MyAppState(); }
class _MyAppState extends State
InAppWebViewController webViewController; InAppWebViewGroupOptions options = InAppWebViewGroupOptions( crossPlatform: InAppWebViewOptions( useShouldOverrideUrlLoading: true, mediaPlaybackRequiresUserGesture: false, ), android: AndroidInAppWebViewOptions( useHybridComposition: true, ), ios: IOSInAppWebViewOptions( allowsInlineMediaPlayback: true, ));
PullToRefreshController pullToRefreshController; String url = ""; double progress = 0; final urlController = TextEditingController();
void requestPermission() async {}
@override void initState() { super.initState();
requestPermission();
pullToRefreshController = PullToRefreshController(
options: PullToRefreshOptions(
color: Colors.blue,
),
onRefresh: () async {
if (Platform.isAndroid) {
webViewController?.reload();
} else if (Platform.isIOS) {
webViewController?.loadUrl(
urlRequest: URLRequest(url: await webViewController?.getUrl()));
}
},
);
}
@override void dispose() { super.dispose(); }
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
leading: IconButton(
color: Colors.black,
icon: Icon(Icons.arrow_back, color: Colors.black),
onPressed: () => Navigator.of(context).pushNamedAndRemoveUntil(
'/', (Route
if (![
"http",
"https",
"file",
"data",
"gojek://",
"shopeeid://",
"javascript",
"about"
].contains(uri.scheme)) {
if (await canLaunch(url)) {
// Launch the App
await launch(
url,
);
// and cancel the request
return NavigationActionPolicy.CANCEL;
}
}
return NavigationActionPolicy.ALLOW;
},
onLoadStop: (controller, url) async {
pullToRefreshController.endRefreshing();
setState(() {
this.url = url.toString();
urlController.text = this.url;
});
},
onLoadError: (controller, url, code, message) {
pullToRefreshController.endRefreshing();
},
onProgressChanged: (controller, progress) {
if (progress == 100) {
pullToRefreshController.endRefreshing();
}
setState(() {
this.progress = progress / 100;
urlController.text = this.url;
});
},
onUpdateVisitedHistory: (controller, url, androidIsReload) {
setState(() {
this.url = url.toString();
urlController.text = this.url;
});
},
onConsoleMessage: (controller, consoleMessage) {
print(consoleMessage);
},
),
progress < 1.0
? LinearProgressIndicator(value: progress)
: Container(),
],
),
),
]))),
);
} }
Seems this plugin in broken for deeplink! hope someone can fixing the url launch scheme if I got coding wrong, please help to fix it. apreciatte!
androidOnGeolocationPermissionsShowPrompt: (InAppWebViewController controller, String origin) async { return GeolocationPermissionShowPromptResponse( origin: origin, allow: true, retain: true ); },
I did the same and also added in AndroidManifest.xml but it is not working, doesn't even fire the event
I got it working I added geolocator: ^6.2.0 in pubspec.yaml and run that package in initState as LocationPermission permission = await Geolocator.checkPermission(); await Geolocator.requestPermission(); await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
then passed in the inappwebview using androidOnGeolocationPermissionsShowPrompt: which worked as a charm
can you please show the code, how you solve it?
Hi @yang5664 yang5664. I tried
androidOnGeolocationPermissionsShowPrompt
in my code. But it only worked on debug mode. After i create release of the app, cannot access location anymore. Any suggestion to fix that?
Information details regarding the feature can be read here... https://developer.android.com/guide/topics/manifest/uses-feature-element#permissions
@yang5664 could you please tell how you got it working for ios?
What is the equivalent of androidOnGeolocationPermissionsShowPrompt
in ios?
@yang5664 could you please tell how you got it working for ios? What is the equivalent of
androidOnGeolocationPermissionsShowPrompt
in ios?
here is my plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>原住民智慧部落</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>EnableBackgroundLocationUpdates</key>
<false/>
<key>FirebaseAppDelegateProxyEnabled</key>
<string>YES</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>MinimumOSVersion</key>
<string>9</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSAppleMusicUsageDescription</key>
<string>App 需要您的同意, 才能訪問媒體庫</string>
<key>NSCalendarsUsageDescription</key>
<string>App 需要您的同意, 才能訪問行事曆</string>
<key>NSContactsUsageDescription</key>
<string>App 需要您的同意, 才能訪問通訊錄</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>地圖遊戲需要取用當前位置</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>地圖遊戲需要取用當前位置</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>地圖遊戲需要取用當前位置</string>
<key>NSMotionUsageDescription</key>
<string>App 需要您的同意, 才能訪問運動與健身</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>App 需要您的同意, 才能使用語音辨識</string>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>io.flutter.embedded_views_preview</key>
<true/>
</dict>
</plist>
Hi @yang5664 yang5664. I tried
androidOnGeolocationPermissionsShowPrompt
in my code. But it only worked on debug mode. After i create release of the app, cannot access location anymore. Any suggestion to fix that?Information details regarding the feature can be read here... https://developer.android.com/guide/topics/manifest/uses-feature-element#permissions
did you try to ask permission from user?
What about iOS?
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.
how to allow Location permission on android?
ios is working correctly but android.
flutter_inappwebview: ^4.0.0+4 flutter: 1.21.0-10.0.pre.113