Developing application for fire TV Stick is similar to Android TV and Box, but there are some different method to access the different feature of the device.
Now I'm trying to get the device(Amazon fire tv stick) location using Wifi location manager, but location returns null as you can see from below code.
private LocationManager locationManager;
@SuppressLint("MissingPermission")
private Location getWifiLocation() {
// SETUP Location Manager
locationManager = (LocationManager) getApplicationContext()
.getSystemService(Context.LOCATION_SERVICE);
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
if (locationManager != null) {
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, myLocationListener);
}
Location location = null;
if (locationManager != null) {
location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
}
return location;
}
private LocationListener myLocationListener
= new LocationListener() {
@Override
public void onLocationChanged(Location location) {
if (location != null) {
double latitude = location.getLatitude();
double longitude = location.getLongitude();
}
}
Thank you for your time.