Click here to Skip to main content
15,920,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in my app i need a map. when i run project in my phone project run and show 'google' icon in bottom of screen.. but street don't show and marker.. this is my code.. please help me.

activity.xml :

XML
<fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/map" android:name="com.google.android.gms.maps.SupportMapFragment" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.s_ghanbari.myapplication31.MapsActivity">


activitymain.java:

Java
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {

    private GoogleMap mMap;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_maps);
        SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map);
        mapFragment.getMapAsync(this);
    }

    @Override
    public void onMapReady(GoogleMap googleMap) {
        mMap = googleMap;

        LatLng sydney = new LatLng(-34, 151);
        mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
        mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
    }
}


manifest.xml

XML
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.s_ghanbari.myapplication31">

    <uses-permission android:name="com.safecomp.googlemaptest.permission.MAPS_RECEIVE">

    <permission android:name="com.safecomp.googlemaptest.permission.MAPS_RECEIVE" android:protectionlevel="signature">

    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES">
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE">
    <uses-permission android:name="android.permission.INTERNET">
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE">
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION">
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION">



    <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsrtl="true" android:theme="@style/AppTheme">

        <meta-data android:name="com.google.android.geo.API_KEY" android:value="@string/google_maps_key">

        <activity android:name=".MapsActivity" android:label="@string/title_activity_maps">
            <intent-filter>
                <action android:name="android.intent.action.MAIN">

                <category android:name="android.intent.category.LAUNCHER">


What I have tried:

i change debug type to relase type
Posted
Comments
mahshid fallah 6-Dec-16 6:25am    
please help me
mahshid fallah 7-Dec-16 0:49am    
please answer my question.i need it.
ridoy 9-Dec-16 15:03pm    
What do you mean by street don't show? Is the map completely blank?
David Crow 6-Jun-17 22:06pm    
What street? The code you've shown just puts a pin near Sydney, AU (with a zoom level near 2). If you zoom in, you'd eventually see streets.

BTW, you don't need ACCESS_COARSE_LOCATION if you are also using ACCESS_FINE_LOCATION.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900