[WIP]Count number of good locations before showing Start button.#5
Open
mizutori wants to merge 1 commit into
Open
[WIP]Count number of good locations before showing Start button.#5mizutori wants to merge 1 commit into
mizutori wants to merge 1 commit into
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a demo to show how we can count good locations before allowing user to track their locations.
Here is the step
1.
Add a varibale
goodGpsCountto count the number of initial good locations.goodGpsCount
2.
In onLocationUpdate, after filtering the new location, if it passes the filter, count up
goodGpsCount.If
goodGpsCountbecomes more than or equal to 3, send broadcast to MainActivity.https://github.com/mizutori/AndroidLocationStarterKitInKotlin/compare/secure-accuracy?expand=1#diff-73ccae8d1b2c89ef24ff25f60549f85125dc67d46c73e466ed9e0c19e2109129R66
3.
In MainActivity, make the
startButtoninvisible in the beginning.https://github.com/mizutori/AndroidLocationStarterKitInKotlin/compare/secure-accuracy?expand=1#diff-e4363ca693431b2287ffc5ce969d0abac1ee05f8729ff2d3a4efda2db4ca9df3R174
4.
When receiving the broadcast of goodGpsCount, make
startButtonvisible.https://github.com/mizutori/AndroidLocationStarterKitInKotlin/compare/secure-accuracy?expand=1#diff-e4363ca693431b2287ffc5ce969d0abac1ee05f8729ff2d3a4efda2db4ca9df3R144
Other Note
filterAndAddLocationtofilterLocationto return null (if location doesn't pass the filter) or location (if the location passes the filter). This is because I want to use this function even before the user pressesstartButton.