Android - Abrir google maps desde webview

 
Vista:

Abrir google maps desde webview

Publicado por aleksangre (5 intervenciones) el 25/04/2016 12:30:37
Hola
Estoy creando una pequeña app, desde la cual tengo datos dinamicos de nombres de ciudades o poblados con su calle, y quiero que desde el webview, al presionar sobre ese dato dinamico me abra el google maps nativo
el codigo que tengo en mainactivity es este:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (url.startsWith("tel:")) {
                startActivity(new Intent(Intent.ACTION_DIAL, Uri.parse(url)));
                return true;
            } else if (url.startsWith("mailto:")) {
                url = url.replaceFirst("mailto:", "");
                url = url.trim();
                Intent i = new Intent(Intent.ACTION_SEND);
                i.setType("plain/text").putExtra(Intent.EXTRA_EMAIL, new String[]{url});
                startActivity(i);
                return true;
            }else {
                if (url.startsWith("geo:")) {
                    Intent searchAddress = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                    startActivity(searchAddress);
                    return true;
                } else {
                    view.loadUrl(url);
                    return true;
                }
            }
        }

y en manifest xml este:
1
2
3
4
5
6
<uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_GPS" />
    <uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" />
    <uses-permission android:name="android.permission.ACCESS_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

que estoy haciendo mal?
Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder