I have a requirement where I want to get the user's current location and based on the user's current location I want to get other user's information from app server and want to show them in a list. Users should be within 5 or 10 km radius.
I fetched users data from server showing it in the app but I want to show within that particular radius. Any help is appreciable.
Show Users who are in 10 KM radius from User current location Android
3.2k Views Asked by AudioBubble At
2
There are 2 best solutions below
Related Questions in ANDROID
- Delay in loading Html Page(WebView) from assets folder in real android device
- MPAndroidChart method setWordWrapEnabled() not found
- Designing a 'new post' android activity
- Android :EditText inside ListView always update first item in the listview
- Android: Transferring Data via ContentIntent
- Wrong xml being inflated android
- AsyncTask Class
- Unable to receive extras in Android Intent
- Website zoomed out on Android default browser
- Square FloatingActionButton with Android Design Library
- Google Maps API Re-size
- Push toolbar content below statusbar
- Android FragmentPagerAdapter Circular listview
- Layout not shifting up when keyboard is open
- auDIO_OUTPUT_FLAG_FAST denied by client can't connect to localhost
Related Questions in GPS
- identify GPS mobile phonegap
- Android runtime permissions on android versions below M?
- iOS Distance between two GPS Location
- GPS not showing current location on map
- java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setTextColor(int)' on a null object reference
- using Gps Getting Latitude and Longitude
- Position marker in Google Map is not disapearing when position is lost
- How to set/get GPS Accuracy on Android Emulator?
- GPSTracker Class not working
- How to Switch ON and OFF GPS
- GPS App compile errors
- OpenGTS platform
- FusedLocationProviderApi Fatal exception: GoogleApiClient is not connected yet.
- SQL LINESTRING() versus multiple rows
- Trouble connecting to gpsd
Related Questions in LOCATION
- How to set resources directory in eclipse dynamic web project?
- Look if current location is near marker
- Drupal location module shows only a portion of Gmap on node page
- iOS 8 CLLocationManager enterRegion: not getting called if use requestWhenInUseAuthorization
- Detect Country then show message?
- Give fake location to Genymotion emulator
- Moving Divs in JavaScript with key presses
- Converting CLLocationCoordinate2D to a String that can be stored
- FusedLocationProviderApi Fatal exception: GoogleApiClient is not connected yet.
- Finding user's current location with Parse and saving it in the Parse database
- Get listview item position after soft keyboard shown
- JavaFX How can I set the location/coordinates of a pane?
- Can a geofence contain many other geofences
- distanceBetween or other way to check if current position is in radius to marker
- JFrame wrong location with Ubuntu (Unity ?)
Related Questions in APPSERVER
- bad_certificate when migrating app server cluster
- upload an app twice in app server and meet errors
- How to connect databases on different serves?
- Error with Wordpress on Appserver
- How to change the logging level of dev_appserver
- WebSphere equivalent in .NET
- Installing & configuring JBoss WildFly in CentOS 8 with different user
- Getting NoClassDefFoundError for class SettableFuture present in com.google.common.util.concurrent package of guava-30.0-jre.jar only in Websphere
- The Node Agent is stopped
- How to install PhpPgAdmin in AppServ?
- Can I get the tenant ID when an app is deployed on AS
- Can we restart Microsoft Azure app service from c#?
- How to get list of applied templates using WLST
- Show Users who are in 10 KM radius from User current location Android
- Java appserver to be iniated in Java application
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You need to use Geofences, Please follow the below steps you definitely get the result as you want.
Let's see how it's work.
Geofencing combines awareness of the user's current location with awareness of the user's proximity to locations that may be of interest. To mark a location of interest, you specify its latitude and longitude. To adjust the proximity for the location, you add a radius. The latitude, longitude, and radius define a geofence, creating a circular area, or fence, around the location of interest.
You can have multiple active geofences, with a limit of 100 per device user.
Now, let's see how we use it in our application,
Set up for Geofence Monitoring
The first step in requesting geofence monitoring is to request the necessary permission. To use geofencing, your app must request ACCESS_FINE_LOCATION. To request this permission, add the following element as a child element of the
<manifest>element in your app manifest:If you want to use an IntentService to listen for geofence transitions, add an element specifying the service name. This element must be a child of the
<application>element:To access the location APIs, you need to create an instance of the Geofencing client. To learn how to connect your client:
Create and Add Geofences
First, use Geofence.Builder to create a geofence, setting the desired radius, duration, and transition types for the geofence. For example, to populate a list object named mGeofenceList:
Specify geofences and initial triggers
The following snippet uses the GeofencingRequest class and its nested GeofencingRequestBuilder class to specify the geofences to monitor and to set how related geofence events are triggered:
Define an Intent for geofence transitions
The Intent sent from Location Services can trigger various actions in your app, but you should not have it start an activity or fragment, because components should only become visible in response to a user action. In many cases, an IntentService is a good way to handle the intent. An IntentService can post a notification, do long-running background work, send intents to other services, or send a broadcast intent. The following snippet shows how to define a PendingIntent that starts an IntentService:
Add geofences
To add geofences, use the GeofencingClient.addGeofences() method. Provide the GeofencingRequest object, and the PendingIntent. The following snippet demonstrates processing the results:
Handle Geofence Transitions
Stop Geofence Monitoring