当前位置: 首页>>代码示例>>Java>>正文


Java SmartLocation类代码示例

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


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

示例1: initSending

import io.nlopez.smartlocation.SmartLocation; //导入依赖的package包/类
private void initSending() {
    //Log.d(TAG, "initSending()");
    readSettings();

    if (keywordReceivedSms) {
        this.sendAcknowledgeMessage(phoneNumber);
    }

    //set bestLocation to null and start time
    startTime = System.currentTimeMillis() / 1000;
    bestLocation = null;

    SmartLocation.with(context).location(new LocationGooglePlayServicesWithFallbackProvider(context))
            .config(LocationParams.NAVIGATION)
            .start(this);

}
 
开发者ID:micku7zu,项目名称:Locate-driver,代码行数:18,代码来源:SmsSenderService.java

示例2: getLocationState

import io.nlopez.smartlocation.SmartLocation; //导入依赖的package包/类
@ReactMethod
public void getLocationState(Promise promise) {
    LocationState locationState = SmartLocation.with(mReactContext).location().state();
    WritableMap map = Arguments.createMap();
    map.putBoolean("locationServicesEnabled", locationState.locationServicesEnabled());
    map.putBoolean("isAnyProviderAvailable", locationState.isAnyProviderAvailable());
    map.putBoolean("isGpsAvailable", locationState.isGpsAvailable());
    map.putBoolean("isNetworkAvailable", locationState.isNetworkAvailable());
    promise.resolve(map);
}
 
开发者ID:mavenave,项目名称:react-native-smartlocation,代码行数:11,代码来源:SmartLocationModule.java

示例3: getLastLocation

import io.nlopez.smartlocation.SmartLocation; //导入依赖的package包/类
private void getLastLocation() {
    Location lastLocation = SmartLocation.with(getActivity()).location().getLastLocation();
    if (lastLocation != null) {
        latitude = lastLocation.getLatitude();
        longitude = lastLocation.getLongitude();
    }
}
 
开发者ID:BeninDevelopers,项目名称:ina-mobile,代码行数:8,代码来源:SearchFragment.java

示例4: initGps

import io.nlopez.smartlocation.SmartLocation; //导入依赖的package包/类
private void initGps() {
    LocationGooglePlayServicesProvider provider = new LocationGooglePlayServicesProvider(this);
    provider.setCheckLocationSettings(true);
    locationControl = new SmartLocation.Builder(this)
            .logging(true)
            .build()
            .location(provider);
}
 
开发者ID:simplesoft-duongdt3,项目名称:Android-App-Template,代码行数:9,代码来源:BaseGpsSupportActivity.java

示例5: getAddressFromCoordinates

import io.nlopez.smartlocation.SmartLocation; //导入依赖的package包/类
public static void getAddressFromCoordinates(Context context, Location location,
											 final OnGeoUtilResultListener onGeoUtilResultListener) {
	SmartLocation.with(context).geocoding().reverse(location, (location1, list) -> {
		String address = list.size() > 0 ? list.get(0).getAddressLine(0) : null;
		onGeoUtilResultListener.onAddressResolved(address);
	});
}
 
开发者ID:ApplicationFactory,项目名称:PEP---Notes,代码行数:8,代码来源:GeocodeHelper.java

示例6: getCoordinatesFromAddress

import io.nlopez.smartlocation.SmartLocation; //导入依赖的package包/类
public static void getCoordinatesFromAddress(Context context, String address, final OnGeoUtilResultListener
		listener) {
	SmartLocation.with(context).geocoding().direct(address, (name, results) -> {
		if (results.size() > 0) {
			listener.onCoordinatesResolved(results.get(0).getLocation(), address);
		}
	});
}
 
开发者ID:ApplicationFactory,项目名称:PEP---Notes,代码行数:9,代码来源:GeocodeHelper.java

示例7: stopListeningForLocationUpdates

import io.nlopez.smartlocation.SmartLocation; //导入依赖的package包/类
@ReactMethod
public void stopListeningForLocationUpdates() {
    SmartLocation.with(mReactContext).location().stop();
}
 
开发者ID:mavenave,项目名称:react-native-smartlocation,代码行数:5,代码来源:SmartLocationModule.java

示例8: onLocationUpdated

import io.nlopez.smartlocation.SmartLocation; //导入依赖的package包/类
@Override
public void onLocationUpdated(Location location) {
    //Log.d(TAG, "LOCATION UPDATE");

    long currentTime = System.currentTimeMillis() / 1000;

    //Log.d(TAG, "Start time: " + startTime + ", Current time: " + currentTime);
    //Log.d(TAG, "Difference: " + (currentTime - startTime));

    if (currentTime - startTime < this.LOCATION_REQUEST_MAX_WAIT_TIME) {
        //Log.d(TAG, "NOT EXPIRED YET. CHECK");

        if (bestLocation == null) {
            bestLocation = location;
        }

        //still null? check again
        if (bestLocation == null) {
            //Log.d(TAG, "BEST LOCATION STILL NULL, CHECK MORE");
            return;
        }

        //Log.d(TAG, bestLocation.toString());
        //Log.d(TAG, location.toString());

        //Log.d(TAG, "HAS ALTITUDE:" + location.hasAltitude());
        //Log.d(TAG, "HAS SPEED: " + location.hasSpeed());
        //Log.d(TAG, "LOCATION PROVIDER: " + location.getProvider());


        if (!bestLocation.getProvider().equals(LocationManager.GPS_PROVIDER) || bestLocation.getProvider().equals(location.getProvider())) {
            //Log.d(TAG, "NOT GPS OR BOTH GPS!");
            if (location.getAccuracy() < bestLocation.getAccuracy()) {
                //Log.d(TAG, "Update best location.");
                bestLocation = location;
            }
        }


        if (this.isLocationFused(bestLocation)) {
            //Log.d(TAG, "Location still fused.");
            return;
        }

        if (bestLocation.getAccuracy() > 100) {
            //Log.d(TAG, "Accuracy more than 100, check again.");
            return;
        }
    }


    //stop the location
    //Log.d(TAG, "STOP LOCATION BECAUSE TIME ELAPSED OR ACCURACY IS GOOD");
    SmartLocation.with(context).location().stop();

    if (bestLocation == null) {
        this.sendSMS(phoneNumber, r.getString(R.string.error_getting_location));
        return;
    }

    if (gpsSms) {
        this.sendLocationMessage(phoneNumber, bestLocation);
    }

    if (googleMapsSms) {
        this.sendGoogleMapsMessage(phoneNumber, bestLocation);
    }

    if (!networkSms) {
        return;
    }

    this.sendNetworkMessage(phoneNumber, bestLocation, place, new OnNetworkMessageSentListener() {
        @Override
        public void onNetworkMessageSent() {
            //Log.d(TAG, "on Network Message Sent");
        }
    });
}
 
开发者ID:micku7zu,项目名称:Locate-driver,代码行数:80,代码来源:SmsSenderService.java

示例9: onDestroy

import io.nlopez.smartlocation.SmartLocation; //导入依赖的package包/类
@Override
protected void onDestroy() {
    super.onDestroy();
    SmartLocation.with(ChooseBranchActivity.this).location().stop();
}
 
开发者ID:AlexisChevalier,项目名称:CarRental-Android-Application,代码行数:6,代码来源:ChooseBranchActivity.java

示例10: initGps

import io.nlopez.smartlocation.SmartLocation; //导入依赖的package包/类
private void initGps() {
    locationControl = new SmartLocation.Builder(this)
            .logging(true)
            .build()
            .location(new LocationGooglePlayServicesWithFallbackProvider(this));
}
 
开发者ID:simplesoft-duongdt3,项目名称:Android-App-Template,代码行数:7,代码来源:LocationService.java

示例11: getLocation

import io.nlopez.smartlocation.SmartLocation; //导入依赖的package包/类
public static void getLocation(Context context, OnGeoUtilResultListener onGeoUtilResultListener) {
	SmartLocation.with(context).location().config(LocationParams.NAVIGATION).provider(new
			LocationGooglePlayServicesWithFallbackProvider(context)).oneFix().start
			(onGeoUtilResultListener::onLocationRetrieved);
}
 
开发者ID:ApplicationFactory,项目名称:PEP---Notes,代码行数:6,代码来源:GeocodeHelper.java


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