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

Java GeoFire类代码示例

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

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



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

示例1: onCreate

import com.firebase.geofire.GeoFire; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    Firebase.setAndroidContext(this);
    firebase = new Firebase("https://brilliant-inferno-9747.firebaseio.com/web/data");
    geofire = new GeoFire(firebase);
    if(mGoogleApiClient == null){
        mGoogleApiClient = new GoogleApiClient.Builder(this)
                .addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this)
                .addApi(LocationServices.API)
                .build();

    }

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tutor);
}
 
开发者ID:StephenVanSon,项目名称:TutorMe,代码行数:18,代码来源:TutorActivity.java


示例2: waitForGeoFireReady

import com.firebase.geofire.GeoFire; //导入依赖的package包/类
/** This lets you blockingly wait until the onGeoFireReady was fired on the provided Geofire instance. */
public void waitForGeoFireReady(GeoFire geoFire) throws InterruptedException {
    final Semaphore semaphore = new Semaphore(0);
    geoFire.getDatabaseReference().addListenerForSingleValueEvent(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            semaphore.release();
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {
            fail("Firebase error: " + databaseError);
        }
    });

    assertTrue("Timeout occured!", semaphore.tryAcquire(timeout, TimeUnit.SECONDS));
}
 
开发者ID:firebase,项目名称:geofire-java,代码行数:18,代码来源:GeoFireTestingRule.java


示例3: HabitEventRepository

import com.firebase.geofire.GeoFire; //导入依赖的package包/类
/**
 * An event repository is tied to a particular user id
 * @param userId the user id
 */
public HabitEventRepository(String userId) {
    mHabitEventsRef = FirebaseDatabase.getInstance().getReference("events/" + userId);
    this.userId = userId;

    mGeoFireRef = FirebaseDatabase.getInstance().getReference("events_geofire/");
    geoFire = new GeoFire(mGeoFireRef);
}
 
开发者ID:CMPUT301F17T13,项目名称:cat-is-a-dog,代码行数:12,代码来源:HabitEventRepository.java


示例4: open

import com.firebase.geofire.GeoFire; //导入依赖的package包/类
/**
 * Set query radius to 5km
 */
@Override
public void open() {
    nearbyEvents.clear();
    DatabaseReference geofire_ref = FirebaseDatabase.getInstance().getReference("events_geofire");

    GeoFire geoFire = new GeoFire(geofire_ref);
    geoQuery = geoFire.queryAtLocation(loc, 5);
    geoQuery.addGeoQueryEventListener(this);
}
 
开发者ID:CMPUT301F17T13,项目名称:cat-is-a-dog,代码行数:13,代码来源:NearbyHabitEventDataSource.java


示例5: saveToFirebase

import com.firebase.geofire.GeoFire; //导入依赖的package包/类
public static void saveToFirebase(GeoFire geoFire,Firebase db, Tutor tutor, Location location){
    if(location != null) {
        Firebase tutorStore = db.child("tutors").child(tutor.getFullName());
        tutorStore.setValue(tutor);
        geoFire.setLocation(tutor.getFullName(), new GeoLocation(location.getLatitude(), location.getLongitude()));
    }
}
 
开发者ID:StephenVanSon,项目名称:TutorMe,代码行数:8,代码来源:Tutor.java


示例6: onCreate

import com.firebase.geofire.GeoFire; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sfvehicles);

    // setup map and camera position
    SupportMapFragment mapFragment = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map);
    this.map = mapFragment.getMap();
    LatLng latLngCenter = new LatLng(INITIAL_CENTER.latitude, INITIAL_CENTER.longitude);
    this.searchCircle = this.map.addCircle(new CircleOptions().center(latLngCenter).radius(1000));
    this.searchCircle.setFillColor(Color.argb(66, 255, 0, 255));
    this.searchCircle.setStrokeColor(Color.argb(66, 0, 0, 0));
    this.map.moveCamera(CameraUpdateFactory.newLatLngZoom(latLngCenter, INITIAL_ZOOM_LEVEL));
    this.map.setOnCameraChangeListener(this);

    FirebaseOptions options = new FirebaseOptions.Builder().setApplicationId("geofire").setDatabaseUrl(GEO_FIRE_DB).build();
    FirebaseApp app = FirebaseApp.initializeApp(this, options);

    // setup GeoFire
    this.geoFire = new GeoFire(FirebaseDatabase.getInstance(app).getReferenceFromUrl(GEO_FIRE_REF));
    // radius in km
    this.geoQuery = this.geoFire.queryAtLocation(INITIAL_CENTER, 1);

    // setup markers
    this.markers = new HashMap<String, Marker>();
}
 
开发者ID:firebase,项目名称:geofire-java,代码行数:27,代码来源:SFVehiclesActivity.java


示例7: onCreate

import com.firebase.geofire.GeoFire; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_nearby);

    geokeys = new ArrayList<>();
    geoLocations = new ArrayList<>();
    geoDistances = new ArrayList<>();
    mToolbar = findViewById(R.id.nearby_app_bar);
    msharedPref = PreferenceManager.getDefaultSharedPreferences(this);
    setSupportActionBar(mToolbar);
    if(getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setTitle("Nearby Areas");
    }

    //initializing the Firebase storage
    ref = FirebaseDatabase.getInstance().getReference("GeoFire");
    mEntertainmentref = FirebaseDatabase.getInstance().getReference("Entertainments");
    geoFire = new GeoFire(ref);

    //for displaying the results
    mRecyclerView = findViewById(R.id.nearby_recyclerView);
    mRecyclerView.setHasFixedSize(true);
    mLayoutManager = new LinearLayoutManager(this);
    mRecyclerView.setLayoutManager(mLayoutManager);

    //Location Manager book keeping stuff
    locationManager = (LocationManager) getApplicationContext().getSystemService(Context.LOCATION_SERVICE);
    Criteria locationCriteria = new Criteria();
    String providerName = locationManager.getBestProvider(locationCriteria,
            true);
    if(providerName != null) {
        mlocation = locationManager.getLastKnownLocation(providerName);
        if(mlocation == null){
            locationManager.requestLocationUpdates(providerName, 1000, 0, this);
        }else{
            processLocation();
        }
    }


}
 
开发者ID:Socialate,项目名称:furry-sniffle,代码行数:44,代码来源:nearbyAreasActivity.java


示例8: initDBConnection

import com.firebase.geofire.GeoFire; //导入依赖的package包/类
public static void initDBConnection(){
    rootReference = new Firebase("https://brilliant-inferno-9747.firebaseio.com/web/data");
    geoFire = new GeoFire(rootReference);
}
 
开发者ID:StephenVanSon,项目名称:TutorMe,代码行数:5,代码来源:DbConnection.java


示例9: getGeoFire

import com.firebase.geofire.GeoFire; //导入依赖的package包/类
public static GeoFire getGeoFire(){
    return geoFire;
}
 
开发者ID:StephenVanSon,项目名称:TutorMe,代码行数:4,代码来源:DbConnection.java


示例10: newTestGeoFire

import com.firebase.geofire.GeoFire; //导入依赖的package包/类
/** This will return you a new Geofire instance that can be used for testing. */
public GeoFire newTestGeoFire() {
    return new GeoFire(databaseReference.child(randomAlphaNumericString(16)));
}
 
开发者ID:firebase,项目名称:geofire-java,代码行数:5,代码来源:GeoFireTestingRule.java


示例11: setLoc

import com.firebase.geofire.GeoFire; //导入依赖的package包/类
/**
 * Sets a given location key from the latitude and longitude on the provided Geofire instance.
 * This operation will run asychronously.
 */
public void setLoc(GeoFire geoFire, String key, double latitude, double longitude) {
    setLoc(geoFire, key, latitude, longitude, false);
}
 
开发者ID:firebase,项目名称:geofire-java,代码行数:8,代码来源:GeoFireTestingRule.java


示例12: removeLoc

import com.firebase.geofire.GeoFire; //导入依赖的package包/类
/**
 * Removes a location on the provided Geofire instance.
 * This operation will run asychronously.
 */
public void removeLoc(GeoFire geoFire, String key) {
    removeLoc(geoFire, key, false);
}
 
开发者ID:firebase,项目名称:geofire-java,代码行数:8,代码来源:GeoFireTestingRule.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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