I am trying to find if the location is from mock provider as shown below
Location location = locationResult.getLastLocation();
if (android.os.Build.VERSION.SDK_INT <= 30)
allLocationData.put("isMock", location.isFromMockProvider());
else if(android.os.Build.VERSION.SDK_INT >= 31)
allLocationData.put("isMock", location.isMock());
Handling mock location is different in Api <= 30
and Api >= 31
. Hence, isMock()
to be used for Api >= 30
. But When I ran above code getting following error
error: cannot find symbol allLocationData.put("isMock", location.isMock());
^
symbol: method isMock()
location: variable location of type Location
Am I missing any import statements here?