android GPS

Skip to first unread message

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

Apr 12, 2013, 2:46:12 PM4/12/13
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 ?

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

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

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

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
0 new messages