Created
May 10, 2018 17:25
-
-
Save parahall/4589e6a7920678300ee727f64333ff19 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LocationWork extends Worker { | |
... | |
public WorkerResult doWork() { | |
Log.d(TAG, "doWork: Started to work"); | |
handlerThread = new HandlerThread("MyHandlerThread"); | |
handlerThread.start(); | |
looper = handlerThread.getLooper(); | |
locationTracker = new LocationTracker(getApplicationContext(), looper); | |
locationTracker.start(); | |
try { | |
locationWait = new CountDownLatch(1); | |
locationWait.await(); | |
Log.d(TAG, "doWork: Countdown released"); | |
} catch (InterruptedException e) { | |
Log.d(TAG, "doWork: CountdownLatch interrupted"); | |
e.printStackTrace(); | |
} | |
cleanUp(); | |
return WorkerResult.SUCCESS; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment