java - Android Google Map not showing my location? -
i working on google map current location application. , there no error detected.
when run application, google map able load not showing current location.
so put logcat here , please me. related
"asset path '/system/framework/com.android.media.remotedisplay.jar' not exist or contains no resources."
? did research on not find solution.
1882-1882/com.example.yan.basicmap i/art﹕ not late-enabling -xcheck:jni (already on) 04-25 23:40:47.534 1882-1882/com.example.yan.basicmap i/zzx﹕ making creator dynamically 04-25 23:40:47.536 1882-1882/com.example.yan.basicmap w/resourcesmanager﹕ asset path '/system/framework/com.android.media.remotedisplay.jar' not exist or contains no resources. 04-25 23:40:47.536 1882-1882/com.example.yan.basicmap w/resourcesmanager﹕ asset path '/system/framework/com.android.location.provider.jar' not exist or contains no resources. 04-25 23:40:47.552 1882-1894/com.example.yan.basicmap i/art﹕ waitforgctocomplete blocked 15.238ms cause background 04-25 23:40:47.698 1882-1882/com.example.yan.basicmap i/google maps android api﹕ google play services client version: 7095000 04-25 23:40:47.908 1882-1882/com.example.yan.basicmap i/google maps android api﹕ google play services package version: 7097470 04-25 23:40:47.912 1882-1894/com.example.yan.basicmap i/art﹕ background sticky concurrent mark sweep gc freed 375(38kb) allocspace objects, 0(0b) los objects, 0% free, 1563kb/1563kb, paused 2.019ms total 257.132ms 04-25 23:40:48.190 1882-1894/com.example.yan.basicmap w/art﹕ suspending threads took: 26.203ms 04-25 23:40:48.199 1882-1894/com.example.yan.basicmap i/art﹕ background partial concurrent mark sweep gc freed 230(18kb) allocspace objects, 0(0b) los objects, 24% free, 1630kb/2mb, paused 31.158ms total 193.459ms 04-25 23:40:48.752 1882-1894/com.example.yan.basicmap w/art﹕ suspending threads took: 9.022ms 04-25 23:40:48.759 1882-1894/com.example.yan.basicmap i/art﹕ background sticky concurrent mark sweep gc freed 19138(735kb) allocspace objects, 2(545kb) los objects, 6% free, 8mb/8mb, paused 11.294ms total 74.473ms 04-25 23:40:48.945 1882-1894/com.example.yan.basicmap i/art﹕ background sticky concurrent mark sweep gc freed 12748(531kb) allocspace objects, 0(0b) los objects, 2% free, 10mb/10mb, paused 11.798ms total 71.362ms 04-25 23:40:50.436 1882-1894/com.example.yan.basicmap i/art﹕ background sticky concurrent mark sweep gc freed 1700(149kb) allocspace objects, 0(0b) los objects, 2% free, 10mb/10mb, paused 4.556ms total 105.593ms 04-25 23:40:50.570 1882-1894/com.example.yan.basicmap i/art﹕ background partial concurrent mark sweep gc freed 1133(91kb) allocspace objects, 0(0b) los objects, 15% free, 10mb/12mb, paused 2.771ms total 112.451ms 04-25 23:40:50.580 1882-1916/com.example.yan.basicmap d/openglrenderer﹕ render dirty regions requested: true 04-25 23:40:50.583 1882-1882/com.example.yan.basicmap d/﹕ hostconnection::get() new host connection established 0xa0174c30, tid 1882 04-25 23:40:50.674 1882-1882/com.example.yan.basicmap d/atlas﹕ validating map... 04-25 23:40:50.700 1882-1916/com.example.yan.basicmap d/﹕ hostconnection::get() new host connection established 0xa015b4c0, tid 1916 04-25 23:40:50.795 1882-1916/com.example.yan.basicmap i/openglrenderer﹕ initialized egl, version 1.4 04-25 23:40:50.888 1882-1916/com.example.yan.basicmap d/openglrenderer﹕ enabling debug mode 0 04-25 23:40:50.962 1882-1916/com.example.yan.basicmap w/egl_emulation﹕ eglsurfaceattrib not implemented 04-25 23:40:50.962 1882-1916/com.example.yan.basicmap w/openglrenderer﹕ failed set egl_swap_behavior on surface 0xa0f71d20, error=egl_success 04-25 23:40:51.140 1882-1913/com.example.yan.basicmap d/﹕ hostconnection::get() new host connection established 0xa0113f10, tid 1913 04-25 23:40:51.735 1882-1882/com.example.yan.basicmap i/mapsactivity﹕ location services connected. 04-25 23:40:53.899 1882-1894/com.example.yan.basicmap i/art﹕ background partial concurrent mark sweep gc freed 2315(140kb) allocspace objects, 5(827kb) los objects, 10% free, 16mb/18mb, paused 1.544ms total 401.616ms 04-25 23:40:59.365 1882-1894/com.example.yan.basicmap i/art﹕ background partial concurrent mark sweep gc freed 473(30kb) allocspace objects, 4(5mb) los objects, 10% free, 16mb/18mb, paused 1.382ms total 102.324ms 04-25 23:41:01.378 1882-1882/com.example.yan.basicmap i/google maps android api﹕ google play services package version: 7097470 04-25 23:41:01.565 1882-1916/com.example.yan.basicmap w/egl_emulation﹕ eglsurfaceattrib not implemented 04-25 23:41:01.565 1882-1916/com.example.yan.basicmap w/openglrenderer﹕ failed set egl_swap_behavior on surface 0xa0f71d20, error=egl_success 04-25 23:41:01.708 1882-2003/com.example.yan.basicmap d/﹕ hostconnection::get() new host connection established 0x9f066af0, tid 2003 04-25 23:41:01.784 1882-1882/com.example.yan.basicmap i/mapsactivity﹕ location services connected. 04-25 23:41:03.463 1882-1894/com.example.yan.basicmap i/art﹕ background partial concurrent mark sweep gc freed 3979(232kb) allocspace objects, 10(5mb) los objects, 10% free, 17mb/19mb, paused 11.308ms total 39.779ms
by default map doesn't show location. location provided different service: google play location api (which supersedes android location api).
this minimum code implement it. first add these in manifest
<uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.access_fine_location" />
then need build googleapiclient in map activity
public class mymapactivity extends activity { private googlemap googlemap; private googleapiclient mgoogleapiclient; protected location mlastlocation; @override public void oncreate(bundle instate) { // whatever initialization including 1 googlemap mgoogleapiclient = new googleapiclient.builder(this) .addconnectioncallbacks(new googleapiclient.connectioncallbacks() { @override public void onconnected(bundle arg0) { // got last location mlastlocation = locationservices.fusedlocationapi .getlastlocation(mgoogleapiclient); // center on map latlng mlatlng = new latlng(mlastlocation.getlatitude(), mlastlocation.getlongitude()); googlemap.animatecamera(cameraupdatefactory.newlatlngzoom (mlatlng, 14), 1000, null); } @override public void onconnectionsuspended(int arg0) { } }) .addonconnectionfailedlistener(new googleapiclient.onconnectionfailedlistener() { @override public void onconnectionfailed(connectionresult conresult) { if (conresult.hasresolution()){ try{ conresult.startresolutionforresult(mymapactivity.this, connection_failure_resolution_request); }catch(sendintentexception e){ e.printstacktrace(); } } }}) .addapi(locationservices.api) .build(); } } @override protected void onstart() { super.onstart(); mgoogleapiclient.connect(); } @override protected void onstop() { super.onstop(); mgoogleapiclient.disconnect(); }
this official how-to reference.
the next problem using emulator need emulate mock position. link better explain how: how emulate gps location in android emulator?
Comments
Post a Comment