Kotlin android 使用 fusedLocationProviderClient 进行请求位置更新。商业用途

问题描述 投票:0回答:1

我这样做,但找不到任何有关我的问题的信息,我可以在商业项目中免费这样做吗,有什么限制吗? 我尝试在网上查找任何信息,但找不到

public class MainActivity extends AppCompatActivity {

    private FusedLocationProviderClient fusedLocationProviderClient;
    TextView locationTextView;
    LocationRequest locationRequest;

    

        fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this);
//Instantiating the Location request and setting the priority and the interval I need to update the location.
        locationRequest = locationRequest.create();
        locationRequest.setInterval(100);
        locationRequest.setFastestInterval(50);
        locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);

//instantiating the LocationCallBack
        LocationCallback locationCallback = new LocationCallback() {
            @Override
            public void onLocationResult(LocationResult locationResult) {
                if (locationResult != null) {
                    if (locationResult == null) {
                        return;
                    }
     //Showing the latitude, longitude and accuracy on the home screen.
                    for (Location location : locationResult.getLocations()) {
                        locationTextView.setText(MessageFormat.format("Lat: {0} Long: {1} Accuracy: {2}", location.getLatitude(),
                                location.getLongitude(), location.getAccuracy()));
                    }
                }
            }
        };
        fusedLocationProviderClient.requestLocationUpdates(locationRequest, locationCallback, Looper.getMainLooper());
    }
}

我可以在商业项目中免费这样做吗?有什么限制吗?

java android kotlin location
1个回答
0
投票

是的,Google Play Services 提供的 API 是免费的,可以用于商业目的。

欲了解更多信息,您可以参考以下链接:

API 概述:https://developers.google.com/android/guides/overview

位置服务:https://developers.google.com/location-context

© www.soinside.com 2019 - 2024. All rights reserved.