About Baidu Map Peripheral Radar callback function will repeatedly invoke the problem of the solution

Source: Internet
Author: User
Tags radar

//Constructs the request parameter, where CENTERPT is its own position coordinate
radarnearbysearchoption option = Newradarnearbysearchoption (). Centerpt (PT). Pagenum (PageIndex). Radius (a);
//Initiate a query request
mmanager.nearbyinforequest (option);
@Override
publicvoidongetnearbyinfolist (radarnearbyresult result,
radarsearcherror Error) {
//TODO auto-generated method stub
if (Error = = Radarsearcherror.radar_no_error) {
Toast.maketext (radardemo.this, "Search peripheral Success", Toast.length_long)
. Show ();
//Get success, process data
} else {
//Get failed
Toast.maketext (radardemo.this, "Query perimeter Failure", Toast.length_long)
. Show ();
        }
}

The above function is Baidu map of the perimeter of the radar callback function, each time the surrounding location query request is called once, not repeated calls.

first of all, this problem, Baidu map perimeter radar heat around the request, will only callback once callback function, this is Baidu technician to answer.
However, when I debug the program, I find that once I query the perimeter, I call a callback function, and when I query the perimeter again, I may recall the callback function two times.
The cause of this problem is because after I complete the surrounding query, but also called the callback function, the surrounding location information is not cleared, so that the callback function will be the last query result callback once again, if the location information is cleared, the code is this:
radarsearchmanager.getinstance (). Removenearbyinfolistener (this);
radarsearchmanager.getinstance (). Clearuserinfo ();
radarsearchmanager.getinstance (). Destroy ();
OK, it took me a day to finish.


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

About Baidu Map Peripheral Radar callback function will repeatedly invoke the problem of the solution

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.