Skip to content

Not working in WorkManager #27

@waqarv712

Description

@waqarv712

I am using this code:

private void getLocationUpdates() {

            TrackerSettings settings =
                    new TrackerSettings()
                            .setUseGPS(true)
                            .setUseNetwork(true)
                            .setUsePassive(true);
//                            .setTimeBetweenUpdates(5000);
//                            .setTimeBetweenUpdates(30 * 60 * 1000)
//                            .setMetersBetweenUpdates(100);

            LocationTracker tracker = new LocationTracker(getApplicationContext(), settings) {
                @Override
                public void onLocationFound(Location location) {
                    // Do some stuff

                    String latlng = location.getLatitude() + ", " + location.getLongitude();

                    Log.d("WorkManager", "onLocationFound: " + latlng);

                }

                @Override
                public void onTimeout() {
                    Log.d("WorkManager", "onTimeout: ");
                }
            };
            tracker.startListening();
    }

in the doWrok() function of WorkManager.
But this code works in the Service.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions