• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ParseGeoPoint类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.parse.ParseGeoPoint的典型用法代码示例。如果您正苦于以下问题:Java ParseGeoPoint类的具体用法?Java ParseGeoPoint怎么用?Java ParseGeoPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ParseGeoPoint类属于com.parse包,在下文中一共展示了ParseGeoPoint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onLocationEvent

import com.parse.ParseGeoPoint; //导入依赖的package包/类
public void onLocationEvent(Location location) {
    if (location.getAccuracy() < LOCATION_ACCURACY_THRESHOLD) {
        if (_locationCache.size() == 10) {
            _locationCache.remove(0);
        }
        _locationCache.add(location);

        if (isActive()) {
            Record record = new Record();
            int lastDetectedActivity = getLastDetectedActivityType();
            if (lastDetectedActivity == ON_FOOT) {
                lastDetectedActivity = WALKING;
            }
            record.setActivityType(lastDetectedActivity);
            record.setUser(ParseUser.getCurrentUser());
            record.setLocation(new ParseGeoPoint(location.getLatitude(),
                                                 location.getLongitude()));
            Account.get()
                   .addRecord(record);
        }
    }
}
 
开发者ID:ralphpina,项目名称:ActivityMapper,代码行数:23,代码来源:LocationManager.java


示例2: getEventFromParseObject

import com.parse.ParseGeoPoint; //导入依赖的package包/类
public static Event getEventFromParseObject(@NonNull ParseObject parseObject){
    ParseGeoPoint location = parseObject.getParseGeoPoint(Event.LOCATION);
    ParseFile parseFile = parseObject.getParseFile(Event.IMAGE);
    return new Event(parseObject.getObjectId(),
            parseObject.getString(Event.TITLE),
            parseObject.getString(Event.DESCRIPTION),
            location != null? location.getLatitude() : Event.INVALID_LOCATION,
            location != null? location.getLongitude() : Event.INVALID_LOCATION,
            parseObject.getString(Event.LOCATION_SUMMARY),
            parseObject.getString(Event.LOCATION_DESCRIPTION),
            parseFile != null? parseFile.getUrl() : null,
            parseObject.getDate(Event.INITIAL_DATE),
            // If end date is null, set it as initial date, so we can use it in our order by
            parseObject.getDate(Event.END_DATE) != null? parseObject.getDate(Event.END_DATE) : parseObject.getDate(Event.INITIAL_DATE),
            parseObject.getInt(Event.TYPE),
            parseObject.getBoolean(Event.ENABLED),
            (parseObject.getNumber(Event.GOING) != null)? parseObject.getNumber(Event.GOING).longValue() : 0,
            parseObject.getString(Event.LINK_URL),
            parseObject.getString(Event.LINK_TEXT),
            parseObject.getUpdatedAt()
    );
}
 
开发者ID:LibertACAO,项目名称:libertacao-android,代码行数:23,代码来源:ParserDtoManager.java


示例3: onItemClick

import com.parse.ParseGeoPoint; //导入依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    ParseGeoPoint userLocation = mUsers.get(position)
            .getUserDetail()
            .getLocation();

    LatLng latLng = new LatLng(userLocation.getLatitude(),
            userLocation.getLongitude());

    mMap.animateCamera(CameraUpdateFactory.newLatLng(latLng));

    Marker userMarker = mMarkers.get(mUsers.get(position).getObjectId());

    if (userMarker != null) {
        userMarker.showInfoWindow();
    }
}
 
开发者ID:tl-nguyen,项目名称:RadarApp,代码行数:18,代码来源:RoomActivity.java


示例4: bindRestaurantViewHolder

import com.parse.ParseGeoPoint; //导入依赖的package包/类
public void bindRestaurantViewHolder() {
    if (restaurantHolder != null && restaurant != null) {
        activity.setTitle(restaurant.getName());

        restaurantHolder.address.setText(restaurant.getAddressLine());

        parseLocation = restaurant.getLocation();
        if (parseLocation != null) {
            LatLng deviceLoc = LocationService.pollDeviceLocation(activity);
            restaurantHolder.proximity.setText(restaurant.getDistanceFromString(new ParseGeoPoint(deviceLoc.latitude,deviceLoc.longitude)));

            LatLng resLoc = new LatLng(parseLocation.getLatitude(), parseLocation.getLongitude());
            restaurantHolder.updateMap(resLoc, restaurant.getName());
        }
    }
}
 
开发者ID:TheBurrd,项目名称:androidClient,代码行数:17,代码来源:RestaurantAdapter.java


示例5: getLocation

import com.parse.ParseGeoPoint; //导入依赖的package包/类
public ParseGeoPoint getLocation(Context context) {
    // Geisel Library - Default Location
    double latitude = 32.881122;
    double longitude = -117.237631;
    LocationService userLocation;
    if (!Build.FINGERPRINT.startsWith("generic")) {
        userLocation = new LocationService(context);
        // Is user location available and are we not running in an emulator
        if (userLocation.canGetLocation()) {
            latitude = userLocation.getLatitude();
            longitude = userLocation.getLongitude();
        } else {
            userLocation.showSettingsAlert();
        }
    }
    return new ParseGeoPoint(latitude,longitude);
}
 
开发者ID:TheBurrd,项目名称:androidClient,代码行数:18,代码来源:QueryParameters.java


示例6: populateMap

import com.parse.ParseGeoPoint; //导入依赖的package包/类
private void populateMap() {
	final GoogleMap map = fragment.getMap();
	map.setMyLocationEnabled(false);
	fragment.getView().post(new Runnable() {
		@Override
		public void run() {
			LatLngBounds.Builder builder = new LatLngBounds.Builder();

			final ParseGeoPoint pt = user.getLocation();
			final LatLng latlng = new LatLng(pt.getLatitude(), pt
					.getLongitude());
			map.addMarker(new MarkerOptions()
					.icon(BitmapDescriptorFactory
							.defaultMarker(BitmapDescriptorFactory.HUE_CYAN))
					.position(latlng));
			builder.include(latlng);			

			map.moveCamera(CameraUpdateFactory.newLatLngZoom(latlng, 13));
		}
	});

}
 
开发者ID:WomenWhoCode,项目名称:MentorMe,代码行数:23,代码来源:ViewProfileActivity.java


示例7: loadMentors

import com.parse.ParseGeoPoint; //导入依赖的package包/类
private void loadMentors(final ParseGeoPoint geoPoint) {
	Double distance = 50.0;
	getProgressBar().setVisibility(View.VISIBLE);
	DataService.getMentors(MentorListActivity.this, geoPoint, distance, mSkill, new FindCallback<User>() {
		@Override
		public void done(final List<User> users, ParseException e) {
			if (e == null) {
				User.saveAllUsers(users);
				DataService.getMentees(User.getUserFacebookIds(users), new Runnable() {
					@Override
					public void run() {
						mentorListAdapter.addAll(User.sortedByMenteeCount(users));
						getProgressBar().setVisibility(View.INVISIBLE);
					}
				});
			} else {
				e.printStackTrace();
			}
			setupDrawer();
		}
	});
}
 
开发者ID:WomenWhoCode,项目名称:MentorMe,代码行数:23,代码来源:MentorListActivity.java


示例8: getDistanceFrom

import com.parse.ParseGeoPoint; //导入依赖的package包/类
public static String getDistanceFrom(ParseUser otherUser){
    //Location
    ParseGeoPoint myLocation = ParseUser.getCurrentUser().getParseGeoPoint(Enums.ParseKey.USER_LOCATION);
    ParseGeoPoint otherLocation = null;
    if(otherUser != null)
        otherLocation = otherUser.getParseGeoPoint(Enums.ParseKey.USER_LOCATION);

    //Calculate distance
    double km = 0;
    if(otherUser != null && otherLocation != null)
        km = myLocation.distanceInKilometersTo(otherLocation);
    else
        km = Math.random() * 4;
    //Update ui
    if(km < 0.5){
        int m = (int)(km * 100);
        m = Math.max(m, 10);    //10 meters at least
        return String.format("within %d m from you", m);
    }
    else{
        return String.format("within %.1f km from you", km);
    }
}
 
开发者ID:DobrinAlexandru,项目名称:Wabbit-Messenger---android-client,代码行数:24,代码来源:LocationUtils.java


示例9: onReceive

import com.parse.ParseGeoPoint; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    try {
        final LocationInfo locationInfo = (LocationInfo) intent.getSerializableExtra(LocationLibraryConstants.LOCATION_BROADCAST_EXTRA_LOCATIONINFO);
        ParseUser.getCurrentUser().put(Enums.ParseKey.USER_LOCATION,
                new ParseGeoPoint(locationInfo.lastLat, locationInfo.lastLong));
        Log.d("Location my", locationInfo.lastLat + " " + locationInfo.lastLong);
        ParseUser.getCurrentUser().saveInBackground();
    }
    catch (Exception e){
        Log.e("location error:", e.getMessage());
    }

    if(MainActivity.gi() != null)
        MainActivity.gi().onLocationUpdate();
}
 
开发者ID:DobrinAlexandru,项目名称:Wabbit-Messenger---android-client,代码行数:17,代码来源:LocationReceiver.java


示例10: retrieveLocations

import com.parse.ParseGeoPoint; //导入依赖的package包/类
public void retrieveLocations(final Callback<List<LatLng>> locationsCallback) {
    ParseQuery<ParseObject> query = ParseQuery.getQuery("Location");
    query.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> parseObjects, ParseException e) {
            if (e == null) {
                ArrayList<LatLng> locations = new ArrayList<LatLng>();
                for (ParseObject object : parseObjects) {
                    ParseGeoPoint geo = object.getParseGeoPoint("geo");
                    locations.add(new LatLng(geo.getLatitude(), geo.getLongitude()));
                }
                locationsCallback.got(locations);
            }
        }
    });
}
 
开发者ID:mg6maciej,项目名称:warsjawa2013-android-squared-googled-preparation,代码行数:17,代码来源:ParseClient.java


示例11: onStartCommand

import com.parse.ParseGeoPoint; //导入依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    super.onStartCommand(intent, flags, startId);

    Log.e("Network Loc Service", "Service running");
    AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);


    Calendar timeOff9 = Calendar.getInstance();

    Intent intent2 = new Intent(this,MyReceiver.class);

    PendingIntent sender = PendingIntent.getBroadcast(this, 0, intent2,
            PendingIntent.FLAG_UPDATE_CURRENT);

    am.set(AlarmManager.RTC_WAKEUP, timeOff9.getTimeInMillis() + 55000, sender);
    ParseGeoPoint pt = new ParseGeoPoint(getLocation().getLatitude(),getLocation().getLongitude());
    ParseUser person = ParseUser.getCurrentUser();
    if(person==null)
    {
        stopSelf();
        return 0;
    }
    person.put("Geolocation",pt);
    person.saveInBackground();
    return START_STICKY;
}
 
开发者ID:AvijitGhosh82,项目名称:Madad_SOS,代码行数:28,代码来源:NetworkLocationService.java


示例12: onLocationChanged

import com.parse.ParseGeoPoint; //导入依赖的package包/类
@Override
public void onLocationChanged(Location location) {
    Log.d(ServiceLocationListener.class.getSimpleName(),
            "Provider: " +location.getProvider() + "|" +
            "Lat/Lng: " + location.getLatitude() + "/" + location.getLongitude());

    if (LocalDb.getInstance() != null) {
        mCurrentUser = LocalDb.getInstance().getCurrentUser();

        UserDetail userDetail = mCurrentUser.getUserDetail();

        userDetail.setLocation(
                new ParseGeoPoint(
                        location.getLatitude(),
                        location.getLongitude()));

        userDetail.setProvider(location.getProvider());

        userDetail.setActive(true);
        try {
            userDetail.save();
        } catch (ParseException e) {
            Log.d(ServiceLocationListener.class.getSimpleName(),
                            e.getMessage());
        }
    }

}
 
开发者ID:tl-nguyen,项目名称:RadarApp,代码行数:29,代码来源:ServiceLocationListener.java


示例13: getDistanceFrom

import com.parse.ParseGeoPoint; //导入依赖的package包/类
public double getDistanceFrom(ParseGeoPoint location) {
    ParseGeoPoint restaurant = getParseGeoPoint("location");

    if (restaurant == null) {
        return 0.0;
    }
    return location.distanceInMilesTo(restaurant);
}
 
开发者ID:TheBurrd,项目名称:androidClient,代码行数:9,代码来源:RestaurantModel.java


示例14: viewUserProfile

import com.parse.ParseGeoPoint; //导入依赖的package包/类
public static void viewUserProfile(final Context context, final long userId, final ParseGeoPoint geoPoint) {
	final Intent intent = new Intent(context, ViewProfileActivity.class);
	intent.putExtra(ViewProfileActivity.USER_ID_KEY, userId);
	intent.putExtra(ViewProfileActivity.LATITUDE_KEY, geoPoint.getLatitude());
	intent.putExtra(ViewProfileActivity.LONGITUDE_KEY, geoPoint.getLongitude());
	context.startActivity(intent);
}
 
开发者ID:WomenWhoCode,项目名称:MentorMe,代码行数:8,代码来源:UIUtils.java


示例15: updateProfile

import com.parse.ParseGeoPoint; //导入依赖的package包/类
@Override
protected void updateProfile(final User profileUser) {
	if (etAddress.getText() != null) {
		profileUser.setAddress(etAddress.getText().toString().trim());
		profileUser.setAboutMe(etAboutme.getText().toString().trim());
		Utils.geocode(getActivity(), new Utils.LocationParams(etAddress.getText().toString()), new Async.Block<Address>() {
			@Override
			public void call(final Address address) {
				if (address != null) {
					profileUser.setLocation(new ParseGeoPoint(address.getLatitude(), address.getLongitude()));
				}
			}
		});
	}
}
 
开发者ID:WomenWhoCode,项目名称:MentorMe,代码行数:16,代码来源:EditProfileLocationFragment.java


示例16: getMentors

import com.parse.ParseGeoPoint; //导入依赖的package包/类
public static void getMentors(Context context, ParseGeoPoint geoPoint, Double distance, String skill, FindCallback<User> callback) {
	ParseQuery<User> query = User.getQuery();		
	query.whereEqualTo(User.IS_MENTOR_KEY, true);
	if(geoPoint != null) {
		query.whereWithinMiles(User.LOCATION_KEY, geoPoint, distance);
	}
	if(skill != null) {
		ArrayList<String> names = new ArrayList<String>();
		if(!skill.equals("All")){
			names.add(skill);
			query.whereContainsAll(User.MENTOR_SKILLS_KEY, names);
		}			
	}
	query.findInBackground(callback);
}
 
开发者ID:WomenWhoCode,项目名称:MentorMe,代码行数:16,代码来源:DataService.java


示例17: MentorListAdapter

import com.parse.ParseGeoPoint; //导入依赖的package包/类
public MentorListAdapter(Context context, ParseGeoPoint geoPoint, final Persona persona, final UserDisplayMode mode) {
	super(context, 0);
	currentGeoPoint = geoPoint;
	this.persona = persona;
	this.userDisplayMode = mode;
	if (!sImageLoaderInitialized) {
		sImageLoaderInitialized = true;
		final ImageLoader imageLoader = ImageLoader.getInstance();
		imageLoader.init(ImageLoaderConfiguration.createDefault(getContext()));
	}
}
 
开发者ID:WomenWhoCode,项目名称:MentorMe,代码行数:12,代码来源:MentorListAdapter.java


示例18: isInLocations

import com.parse.ParseGeoPoint; //导入依赖的package包/类
private boolean isInLocations(List<ParseObject> parseObjects) {
    if(parseObjects == null)
        return false;
    Log.d("locations", "Retrieved " + parseObjects.size() + " locations");
    boolean isReleasedAtLocation = false;
    for(ParseObject po : parseObjects){
        if(po.getBoolean(Enums.ParseKey.PLACE_RELEASED)) {
            ParseGeoPoint point = po.getParseGeoPoint(Enums.ParseKey.USER_LOCATION);
            double radius = po.getDouble(Enums.ParseKey.PLACE_RADIUS); //KM
            float[] results = new float[3];
            Location.distanceBetween(point.getLatitude(), point.getLongitude(),
                    locationInfo.lastLat, locationInfo.lastLong, results);
            Log.d("distance", Float.toString(results[0]));

            if(results[0] <= radius * 1000) {
                isReleasedAtLocation = true;
                break;
            }
        }
    }
    if(!isReleasedAtLocation) {
        showNotReleasedAtLocationDialog();
        dismissDialog();
        return false;
    }
    else
        return true;
}
 
开发者ID:DobrinAlexandru,项目名称:Wabbit-Messenger---android-client,代码行数:29,代码来源:PeopleNearbyFragment.java


示例19: getDistanceInMeters

import com.parse.ParseGeoPoint; //导入依赖的package包/类
public static int getDistanceInMeters(ParseUser otherUser){
    //Location
    ParseGeoPoint myLocation = ParseUser.getCurrentUser().getParseGeoPoint(Enums.ParseKey.USER_LOCATION);
    ParseGeoPoint otherLocation = null;
    if(otherUser != null)
        otherLocation = otherUser.getParseGeoPoint(Enums.ParseKey.USER_LOCATION);

    //Calculate distance
    double km = 0;
    if(otherUser != null && otherLocation != null)
        km = myLocation.distanceInKilometersTo(otherLocation);
    return (int)(km * 1000);
}
 
开发者ID:DobrinAlexandru,项目名称:Wabbit-Messenger---android-client,代码行数:14,代码来源:LocationUtils.java


示例20: readAllInArea

import com.parse.ParseGeoPoint; //导入依赖的package包/类
@Override
public void readAllInArea(final double latitude, final double longitude, final double maxDistance, final PointOfInterestReadHandler handler) {
	ParseGeoPoint userLocation = new ParseGeoPoint(latitude, longitude);
	ParseQuery<ParseObject> query = ParseQuery.getQuery(POI_TABLE); 
	query.whereEqualTo(DELETED, false);
	query.whereWithinKilometers(LOCATION, userLocation, maxDistance);
	query.setLimit(POINTS_AMOUNT_LOMIT);
	
	query.findInBackground(new FindCallback<ParseObject>() {
		
		@Override
		public void done(List<ParseObject> objects, ParseException e) {
			if (e == null) {
				List<PointLocation> points = new ArrayList<PointLocation>();
				for (ParseObject object : objects) {
					points.add(getLocation(object));
				}
				handler.readAllInAreaCompleted(points);
			} else {
				String errorMessage = String.format(Locale.US, "readAllInArea failed with parameters: (latitude=%f, longitude=%f, maxDistance=%f)", 
						latitude, longitude, maxDistance);
				Log.e(LOG_TAG, errorMessage, e);
				handler.readAllInAreaFailed(latitude, longitude, maxDistance, e);
			}
		}
	});
}
 
开发者ID:benbek,项目名称:HereAStory-Android,代码行数:28,代码来源:ParseDatabaseServiceImpl.java



注:本文中的com.parse.ParseGeoPoint类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NativeArray类代码示例发布时间:2022-05-21
下一篇:
Java Win32ErrorMode类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap