Android IsLocationOnPath不工作
我正在我的应用程序中检查用户是否遵循给定的路线图。我正在检查当前位置中的用户更改,并在我的位置更改方法中调用了isLocationOnPath,如下所示Android IsLocationOnPath不工作,android,google-maps,routes,polyline,Android,Google Maps,Routes,Polyline,我正在我的应用程序中检查用户是否遵循给定的路线图。我正在检查当前位置中的用户更改,并在我的位置更改方法中调用了isLocationOnPath,如下所示 try { final Runnable r = new Runnable() { public void run() { if (handelrCheck) { if (visitedPoints.
try {
final Runnable r = new Runnable() {
public void run() {
if (handelrCheck) {
if (visitedPoints.size() != allQuestions.size() && QuestionOnTheRoute() < mCircle.getRadius() && !isDone() && Integer.parseInt(allQuestions.get(questionNumber).getSequence())==sequenceFlag) {
visitedPoints.add(new LatLng(Double.parseDouble(allQuestions.get(questionNumber).getLat()), Double.parseDouble(allQuestions.get(questionNumber).getLng())));
showPopup(); // show question pop up when it is inside user radius
//add viisited check point to menu
VisitedcheckPoint++;
sequenceFlag++;
heading5.add("" + VisitedcheckPoint);
for (int i = 0; i < heading5.size(); i++) {
if (heading5.size() > 1) {
heading5.remove(0);
}
}
}
else if (checkCompleteSurvey()<mCircle.getRadius()) { // when user complete survey
handelrCheck = false;
handlerForQuestions = null;
showAllAnswers(); // show all ansers to user when user complete survey
}
else if(!PolyUtil.isLocationOnPath(new LatLng(AppPreferences.getLatitude(mCurrentActivity),AppPreferences.getLongitude( mCurrentActivity)),routePoints,true,10)){
Toast.makeText(mCurrentActivity, "Please follow the selected route for experiment", Toast.LENGTH_SHORT).show();
}
// else if (visitedPoints.size() == databaseHandler.getQuestionOnRoute().size()) { // when user complete survey
// handelrCheck = false;
// handlerForQuestions = null;
// showAllAnswers(); // show all ansers to user when user complete survey
//
// }
}
if (handlerForQuestions != null)
handlerForQuestions.postDelayed(this, pooltime);
}
};
handlerForQuestions.postDelayed(r, pooltime);
} catch (Exception e) {
e.printStackTrace();
}
试试看{
最终可运行r=新可运行(){
公开募捐{
如果(手动检查){
if(visitedPoints.size()!=allQuestions.size()&&questiontheroute()1){
头部5.移除(0);
}
}
}
如果(checkCompleteSurvey()有人能帮我吗?这里没有人帮我吗?你找到解决办法了吗?