I have made a simple Google map in Android but the problem is that only zoom buttons are found on running IM and map loads Not happening I have generated the API key 3 times. Here is a clear file
& Lt; Use-enabled Android: glEVersion = "0x00020000" Android: required = "true" /> & Lt; Usage-permission Android: name = "android.permission.INTERNET" /> & Lt; Usage-permission Android: name = "android.permission.ACCESS_NETWORK_STATE" /> & Lt; Usage-permission Android: name = "android.permission.WRITE_EXTERNAL_STORAGE" /> & Lt; Use-permission Android: name = "com.google.android.providers.gsf.permission.READ_GSERVICES" /> & Lt ;! - Location requires the following two permissions - & gt; & Lt; Usage-permission Android: name = "android.permission.ACCESS_COARSE_LOCATION" /> & Lt; Usage-permission Android: name = "android.permission.ACCESS_FINE_LOCATION" /> & Lt; Android Android: allowBackup = "true" android: icon = "@draubable / IC_Luncher" Android: label = "@ string / app_name" Android: Theme = "@ Style / Aaptim" & gt; & Lt; Activity Android: name = "com.amal.googlemap.MainActivity" android: label = "@ string / app_name" & gt; & Lt; Intent-Filter & gt; & Lt; Action Android: name = "android.intent.action.MAIN" /> & Lt; Category android: name = "android.intent.category.LAUNCHER" /> & Lt; / Intent-Filter & gt; & Lt; / Activity & gt; & Lt; Meta-Data Android: name = "com.google.android.maps.v2.API_KEY" Android: value = "AIzaSyCh4vRdbH__Dgg7n-3t8TTkhsUVC8CtNKM" /> & Lt; Meta-Data Android: name = "com.google.android.gms.version" android: value = "@ integer / google_play_services_version" /> & Lt; / Application & gt; & Lt; / Reveal & gt;
Here xml file `
`
Here is the class file
The public class extends MainActivity activity {GoogleMap Map; @ Override Protected Zero (Bundle Saved Instantstate) {Super. NET (Saved Instantstate); SetContentView (R.layout.activity_main); Map = ((MapFragment) getFragmentManager () FindFragmentById (R.id.map)). GetMap (); Map.setMapType (GoogleMap.MAP_TYPE_SATELLITE); LatLng latLng = new wave long (13.05241, 80.25082); Map.addMarker (new marker option.) Status (latLng). Title ("raj amal"));
If anyone can help
Updates
First you check that the Google Display Services library has been added to your project, then
use fractal activity activity V4 and not v7 from support libraries This should work:
Public class provides main activity piece detail {GoogleMap googleMap;
On the Create
int position = GooglePlayServicesUtil.isGooglePlayServicesAvailable (getBaseContext ()); If (status! = Connection result. SUCCESS) {int requestCode = 10; Dialog dialog = GooglePlayServicesUtil.getErrorDialog (status, this, requestCode); Dialog.show (); } Other {SupportMapFragment fm = (SupportMapFragment) getSupportFragmentManager (). FindFragmentById (R.id.map); GoogleMap = fm.getMap (); }
No comments:
Post a Comment