相关疑难解决方法(0)

android webview地理定位

我必须在a中检索用户的位置WebView.我使用以下Javascript执行此操作:

function getLocation() {
   navigator.geolocation.getCurrentPosition(displayLocation, handleError);
}
Run Code Online (Sandbox Code Playgroud)

但是权限请求弹出窗口永远不会打开.

我设置了这些设置:

ws.setJavaScriptEnabled(true);
ws.setGeolocationEnabled(true);
ws.setJavaScriptCanOpenWindowsAutomatically(true);
Run Code Online (Sandbox Code Playgroud)

从一个位置访问用户位置的正确方法是WebView什么?

android geolocation

97
推荐指数
6
解决办法
7万
查看次数

java.lang.SecurityException"gps"位置提供程序需要ACCESS_FINE_LOCATION权限

所以这是我的MyLocationListener类

package com.example.gpslocater;

import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;

public class MyLocationListener implements LocationListener {

        public TextView mLocationTextView;
    Context mContent;
    public MyLocationListener(Context context) {
        mContent = context;
    }
    @Override
    public void onLocationChanged(Location location) {

        location.getLatitude();
        location.getLongitude();

        String Text = "My current location is :" + 
        "Latitude = " + location.getLatitude() +
        " Longitude = " + location.getLongitude();
        //figure out a way to make it display through a text view
        mLocationTextView.setText(Text);
    }

    @Override
    public void …
Run Code Online (Sandbox Code Playgroud)

android

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

android ×2

geolocation ×1