Wikipedia:ILee88/WebMap

Tích hợp webmap trên mobile app - geolocation

Dùng định vị của browser:

  1. Gặp thông báo về quyền truy cập geolocation của trình duyệt không thể thay đổi hay can thiệp vào thông báo này trên web browser.
  2. Android: Trường hợp tích hợp vào app của android thì có thể hiệu chỉnh được nội dung thông báo.
    1. Tham khảo cách làm cho Xamarin webbrowser tại đây https://forums.xamarin.com/discussion/150646/geolocation-in-webview
  3. iOS: Chưa thấy giải pháp hiệu chỉnh. Và gần như khi chạy sẽ hiện 2 thông báo: 1 xin quyền từ ứng dụng (nếu ứng dụng có xin quyền), 1 xin quyền từ trình duyệt.

Trường hợp này bên app của Q7 đang dùng và đang bị tình trạng tương tự cho 3 trường hợp trên.

Dùng định vị của thiết bị từ app thông qua webview control trong Xamarin

Link tham khảo tương tác giữa App với Web: https://blog.klimczyk.pl/posts/2019/04/call-js-in-csharp-in-xamarin C# and JS calls in Xamarin (both ways)

  1. Từ giao diện nhấn control định vị sẽ gọi hàm getLocation. Hàm này bên Xamarim khai báo hàm dạng JavascriptInterface như trong link hướng dẫn.
  2. Trong hàm getLocation này sẽ xử lý lấy thông tin geoLocation (GPS vị trí) từ thiết bị chuyển thành text Json với định dạng thông tin như sau (tô đậm là bắt buộc có): {"coords":{"altitude":10.32386589050293,"altitudeAccuracy":10,"latitude":10.774976628311665,"accuracy":65,"longitude":106.64943554152055,"heading":-1,"speed":-1},"timestamp":1582015638093.1501}
  3. Sau khi có geoLocation thì gọi hàm javascript (xem cách làm trong link hướng dẫn) setDeviceLocation (đã định nghĩa sẵn) truyền chuỗi kết quả text Json từ bước 2.

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.