1.Android webview html5å°çå®ä½
Android webview html5å°çå®ä½
ææ¥çäºä¸æºç 解å³äºï¼ä¸»è¦ä»£ç å¦ä¸ï¼//å¯ç¨æ°æ®åºwebSettings.setDatabaseEnabled(true);Stringdir=this.getApplicationContext().getDir("database",safari 查看html源码Context.MODE_PRIVATE).getPath();//å¯ç¨å°çå®ä½webSettings.setGeolocationEnabled(true);//设置å®ä½çæ°æ®åºè·¯å¾webSettings.setGeolocationDatabasePath(dir);//æéè¦çæ¹æ³ï¼ä¸å®è¦è®¾ç½®ï¼è¿å°±æ¯åºä¸æ¥ç主è¦åå webSettings.setDomStorageEnabledï¼trueï¼//é ç½®æéï¼åæ ·å¨WebChromeClientä¸å®ç°ï¼publicvoidonGeolocationPermissionsShowPrompt(Stringorigin,GeolocationPermissions.Callbackcallback){ callback.invoke(origin,true,false);super.onGeolocationPermissionsShowPrompt(origin,callback);}é ç½®æéï¼<uses-permissionandroid:name="android.permission.ACCESS_FINE_LOCATION"/><uses-permissionandroid:name="android.permission.ACCESS_COARSE_LOCATION"/>