java - onLocationChanged not being called within the IndoorAtlas location manager -
when testing able receive updates onstatuschanged within ialocationlistener, onlocationchanged not being called. ideas why is?
i have followed instructions indooratlas (http://docs.indooratlas.com/android/dev-guide/getting-user-location.html) video youtube (https://www.youtube.com/watch?v=2exkv4xl5rg) still not able location.
do have in area have mapped or should read location no matter am?
package com.bignerdranch.android.indoormapping; import android.manifest; import android.support.v4.app.activitycompat; import android.support.v4.app.fragment; import android.support.v4.app.fragmentactivity; import android.support.v4.app.fragmentmanager; import android.os.bundle; import android.util.log; import com.indooratlas.android.sdk.ialocation; import com.indooratlas.android.sdk.ialocationlistener; import com.indooratlas.android.sdk.ialocationmanager; import com.indooratlas.android.sdk.ialocationrequest; public class mappingactivity extends fragmentactivity { private final int code_permissions = 0; private ialocationmanager mialocationmanager; private static final string tag = "locateactivity"; private ialocationlistener mialocationlistener = new ialocationlistener() { @override public void onlocationchanged(ialocation ialocation) { log.d(tag, "latitude: " + ialocation.getlatitude()); } @override public void onstatuschanged(string s, int i, bundle bundle) { } }; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_mapping); mialocationmanager = ialocationmanager.create(this); // request permissions coarse location , wifi string[] neededpermissions = { manifest.permission.change_wifi_state, manifest.permission.access_wifi_state, manifest.permission.access_coarse_location }; activitycompat.requestpermissions( this, neededpermissions, code_permissions ); fragmentmanager fm = getsupportfragmentmanager(); fragment fragment = fm.findfragmentbyid(r.id.fragment_cont); if(fragment == null) { fragment = new mappingfragment(); fm.begintransaction() .add(r.id.fragment_cont, fragment) .commit(); } } // handle permissions denied @override public void onrequestpermissionsresult(int requestcode, string[] permissions, int[] grantresults) { super.onrequestpermissionsresult(requestcode, permissions, grantresults); } @override public void onresume() { super.onresume(); mialocationmanager.requestlocationupdates(ialocationrequest.create(), mialocationlistener); } @override public void onpause() { super.onpause(); mialocationmanager.removelocationupdates(mialocationlistener); } }
here indooratlas has given code examples of sdk. should able find issue.
Comments
Post a Comment