Not Getting Location Updates

This is a discussion on Not Getting Location Updates within the Beginning Developers forums, part of the Android Development category; I have written an activity when started will get location updates of the smart phone itself and write somewhere with the help of a web ...

Results 1 to 2 of 2

Thread: Not Getting Location Updates

  1. #1
    Android Lurker asmitakulkarni's Avatar
    Join Date
    Oct 2011
    Posts
    8

    Not Getting Location Updates

    I have written an activity when started will get location updates of the smart phone itself and write somewhere with the help of a web service.

    For that purpose I have have followed some kep setps as below -
    • <uses-permissionandroid:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
    • <uses-permissionandroid:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>

    • LocationManager locManager = (LocationManager) getSystemService(Context.
      LOCATION_SERVICE
      );
      // Get the best provider from the criteria specified, and false to say it can turn the provider on if it isn't already
      // String bestProvider = locManager.getBestProvider(criteria, false);
      List<String> providers = locManager.getAllProviders();Iterator itr=providers.iterator();
      while
      ( itr.hasNext())
      this
      );
      this, pr, Toast.LENGTH_LONG
      ).show();
    This how I have registered for location updates

    • public
      void onLocationChanged(Location location) {// TODO Auto-generated method stub
      try {latitude = location.getLatitude();longitude = location.getLongitude();Toast.makeText(this, "Location Changed", Toast.LENGTH_LONG);addrList = geoCoder.getFromLocation(latitude, longitude, 3);new CallWebService().doInBackground();} catch (Exception e) {Log.i("Error while getiing Location Updates", e.getMessage());errFlg = true;}}
      This is how I have handled the event, locationChanged

      I am putting toast messages for testing purpose & from that I have observed that the controls never goes in locationChanged method.


      i.e. I am not getting location updates.


  2. Android.net is the premier Android Forum. Registered users do not see these ads. .

  3. #2
    Android Lurker asmitakulkarni's Avatar
    Join Date
    Oct 2011
    Posts
    8
    I am sorry for the code in my last post , it was distorted by some reason.

    Now this my refined post.

    I have written an activity when started will get location updates of the smart phone itself and write somewhere with the help of a web service.

    For that purpose I have have followed some kep setps as below -
    • <uses-permissionandroid:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
    • <uses-permissionandroid:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>

    • LocationManager locManager = (LocationManager) getSystemService(Context.
      LOCATION_SERVICE);// Get the best provider from the criteria specified, and false to say it can turn the provider on if it isn't already
      // String bestProvider = locManager.getBestProvider(criteria, false);
      List<String> providers = locManager.getAllProviders();Iterator itr=providers.iterator();
      while( itr.hasNext()){String pr=(String)itr.next();locManager.requestLocationUp dates(pr, 1050000L, 50, this);Toast.makeText(this, pr, Toast.LENGTH_LONG).show();}
      This how I have registered for location updates


      • public
        void onLocationChanged(Location location) {// TODO Auto-generated method stubtry {latitude = location.getLatitude();longitude = location.getLongitude();Toast.makeText(this, "Location Changed", Toast.LENGTH_LONG);addrList = geoCoder.getFromLocation(latitude, longitude, 3);new CallWebService().doInBackground();} catch (Exception e) {Log.i("Error while getiing Location Updates", e.getMessage());errFlg = true;}}
        This is how I have handled the event, locationChanged

        I am putting toast messages for testing purpose & from that I have observed that the controls never goes in locationChanged method.


        i.e. I am not getting location updates.


Remove Ads

http://www.scramblerducati.org/

Sponsored Links

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Similar Threads

  1. Network Speed By Location
    By TMODroids User in forum Nexus One
    Replies: 11
    Last Post: 10-29-2012, 09:29 AM
  2. SDK location
    By KansaiRobot in forum Beginning Developers
    Replies: 4
    Last Post: 03-13-2011, 07:01 PM
  3. location on pictures?
    By heythere_sunshinexdjf in forum LG Ally Help
    Replies: 2
    Last Post: 11-10-2010, 02:08 PM
  4. My Location
    By roban in forum LG Ally Help
    Replies: 2
    Last Post: 08-24-2010, 09:07 AM

Search tags for this page

android getting location from thread

,

android getting location update with best known provider

,

android not getting location

,

android not getting onlocationupdates()

,

incredible onlocationchanged

Click on a term to search our sites for related topics.
Android Forum