android GPS

24 views
Skip to first unread message

Эдуард Зозуля

unread,
Apr 12, 2013, 2:46:12 PM4/12/13
to he...@googlegroups.com
Hi !

there is advancement in GPS

I do so:

set context [activity]
set locationservice [$context getsystemservice LOCATION_SERVICE]

but call
$locationservice getAllProviders

crash my program

that to do ?

Эдуард Зозуля

unread,
Sep 26, 2013, 1:51:08 PM9/26/13
to he...@googlegroups.com
I got to remove the data from the GPS receiver.

First, added new class to java cod:
==============================
package org.hecl.location;


import android.app.Application;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.Log;

public class LocationGet extends Application {

  public int requestLocationUpdates(LocationManager locationManager) {
    //LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);

    LocationListener locationListener = new LocationListener() {
      public void onLocationChanged(Location location) {}
      public void onStatusChanged(String provider, int status, Bundle extras) {}
      public void onProviderEnabled(String provider) {}
      public void onProviderDisabled(String provider) {}
    };

    // Register the listener with the Location Manager to receive location updates
    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
    return 7;
  }
}

==============================================


Then, do the following:

proc Timer { ls } {
  set loct [$ls getlastknownlocation gps]
  after 1000 [list Timer $ls]
}


java android.location.LocationManager lm
java android.location.LocationProvider lp
java android.location.LocationListener ll
java org.hecl.location.LocationGet lg
set ls [$context getsystemservice LOCATION_SERVICE]
   
set a [lg -new {}]
set b [$a requestlocationupdates $ls]

Timer $ls

======================================================

But if I'm in the Timer sets the value for the widget edittext, its value is not updated.
The reason?


I think in the command "after".

How to get around this inconvenience?

Reply all
Reply to author
Forward
0 new messages