[Android] Parse Development notes (3) -- Implement the nearby searching function (LBS)

Source: Internet
Author: User


Preface

We are still worried that Parse does not support complex SQL queries. For example, we can find people nearby, today, I carefully read the article "Parse-based cloud services for Android Applications". unexpectedly, I directly provided an API, which is dedicated to the mobile background!

 


You are welcome to repost, but please keep the original source of the article :)

Blog: http://www.cnblogs.com

Farmer's uncle: http://over140.cnblogs.com

 

Body

I. Series

1. [Parse] development notes (1) -- Preparation

2. [Parse] development notes (2) -- import Data from Mysql to Parse Data

 

II. Introduction

To find people nearby, follow these steps: locate the device to obtain the geographical location information, upload the data to the server, and obtain the data by comparing and sorting the data.

 

Iii. Mysql version

Typical SQL statements include:

ORDER

(PS ~~~, If the data volume is large and multiple tables are associated, this statement takes a break from cainiao ~~~)

 

Iv. Parse version

List <ParseObject> queryAroundUsers (Context ctx, POUser user, minute, startIndex, pageSize) ParseException {
ParseQuery query = ParseQuery ("nmbb_user ");
ParseGeoPoint point = ParseGeoPoint ();
Point. setLatitude (user. locationLatitude );
Point. setlongpolling (user. locationlongpolling );
Query. whereWithinKilometers ("location", point, 5); query. setSkip (startIndex );
Query. setLimit (pageSize );
Query. find ();
}

 

1. ParseQuery provides a very considerate method:

2. Two related methods:

3. The ParseGeoPoint object can be stored. If the data type is GeoPoint, add this field to save it.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.