本文整理汇总了Java中com.patloew.rxlocation.RxLocation类的典型用法代码示例。如果您正苦于以下问题:Java RxLocation类的具体用法?Java RxLocation怎么用?Java RxLocation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RxLocation类属于com.patloew.rxlocation包,在下文中一共展示了RxLocation类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: startLocationScan
import com.patloew.rxlocation.RxLocation; //导入依赖的package包/类
private void startLocationScan() {
RxLocation rxLocation = new RxLocation(this);
LocationRequest locationRequest = LocationRequest.create()
.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
.setInterval(TimeUnit.SECONDS.toMillis(5));
rxLocationObserver = rxLocation.location()
.updates(locationRequest)
.subscribeOn(Schedulers.io())
.flatMap(location -> rxLocation.geocoding().fromLocation(location).toObservable())
.observeOn(Schedulers.io())
.subscribeWith(new DisposableObserver<Address>() {
@Override public void onNext(Address address) {
boolean isLocationsEnabled = App.INSTANCE.getSharedPreferences().isLocationsEnabled();
if (isLocationsEnabled) {
mOWDevice.setGpsLocation(address);
} else if (rxLocationObserver != null) {
rxLocationObserver.dispose();
}
}
@Override public void onError(Throwable e) {
Log.e(TAG, "onError: error retreiving location", e);
}
@Override public void onComplete() {
Log.d(TAG, "onComplete: ");
}
});
}
开发者ID:ponewheel,项目名称:android-ponewheel,代码行数:34,代码来源:MainActivity.java
示例2: onCreate
import com.patloew.rxlocation.RxLocation; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
ButterKnife.bind(this);
rxPermissions = new RxPermissions(this);
rxLocation = new RxLocation(this);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
rvNearbyRestaurant.setLayoutManager(linearLayoutManager);
// get users last known location
getLastKnownLocation(searchTerm);
endlessRecyclerViewScrollListener = new EndlessRecyclerViewScrollListener(linearLayoutManager) {
@Override
public void onLoadMore(int page, int totalItemsCount, RecyclerView view) {
offset = totalItemsCount;
loadData(searchTerm, lastKnownLocation, offset);
}
};
rvNearbyRestaurant.addOnScrollListener(endlessRecyclerViewScrollListener);
}
开发者ID:pranayairan,项目名称:YelpQL,代码行数:26,代码来源:SearchActivity.java
示例3: onCreate
import com.patloew.rxlocation.RxLocation; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
if (BuildConfig.DEBUG) {
Timber.plant(new Timber.DebugTree());
}
RealmContract.configureRealm(this);
FirebaseApp.initializeApp(this);
rxLocation = new RxLocation(this);
}
开发者ID:BANKEX,项目名称:smart-asset-iot-android-demo,代码行数:13,代码来源:DemoApplication.java
示例4: RxLocationManager
import com.patloew.rxlocation.RxLocation; //导入依赖的package包/类
public RxLocationManager(RxLocation rxLocation) {
this.rxLocation = rxLocation;
locationRequest = buildLocationRequest();
}
开发者ID:BANKEX,项目名称:smart-asset-iot-android-demo,代码行数:5,代码来源:RxLocationManager.java
示例5: getRxLocation
import com.patloew.rxlocation.RxLocation; //导入依赖的package包/类
public RxLocation getRxLocation() {
return rxLocation;
}
开发者ID:BANKEX,项目名称:smart-asset-iot-android-demo,代码行数:4,代码来源:DemoApplication.java
示例6: RxGps
import com.patloew.rxlocation.RxLocation; //导入依赖的package包/类
public RxGps(RxLocation rxLocation, Activity activity) {
this.rxLocation = rxLocation;
this.rxPermissions = new RxPermissions(activity);
this.activityReference = new WeakReference<Activity>(activity);
}
开发者ID:florent37,项目名称:RxGps,代码行数:6,代码来源:RxGps.java
示例7: onCreate
import com.patloew.rxlocation.RxLocation; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bloop);
mBootprintMapFragment = new BootprintMapFragment();
mBootprintMapFragment.setArguments(savedInstanceState);
getSupportFragmentManager()
.beginTransaction()
.add(R.id.map_container, mBootprintMapFragment)
.commit();
ButterKnife.bind(this);
// init global references / api stuff
mApplication = BloopApplication.getInstance();
mGoogleApiClient = mApplication.getGoogleApiClient();
// makes achievement dialogs visible
Games.setViewForPopups(
mGoogleApiClient,
getWindow().getDecorView().findViewById(android.R.id.content)
);
mService = mApplication.getService();
// hide flag by default
mPlaceFlagButtonMarginBottom = getResources().getDimension(R.dimen.fab_margin);
mPlaceFlagButton.setVisibility(View.INVISIBLE);
// also hide text telling user to place flags
mCannotCaptureTextView.setVisibility(View.INVISIBLE);
checkHasPlacedFlag();
mPlaceFlagButton.setOnClickListener(view -> placeFlag());
mBigButtonView.setOnClickListener(view -> captureFlag());
// init location
mRxLocation = new RxLocation(this);
startTrackingLocation();
// init blooping
mBloopHandler = new Handler();
setSupportActionBar(mToolbar);
// init sounds
mBloopSoundPlayer = new BloopSoundPlayer(this);
// mute logic
mutePref = getSharedPreferences(PREF_SOUND, Context.MODE_PRIVATE);
mute = mutePref.getBoolean(PREF_SOUND_VAL, false);
}
开发者ID:BloopApp,项目名称:Bloop,代码行数:57,代码来源:BloopActivity.java
注:本文中的com.patloew.rxlocation.RxLocation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论