bitrise-steplib / steps-virtual-device-testing-for-android

MIT License
22 stars 23 forks source link

Cannot use device location (Google Play Services : maps) #13

Closed Aissa-H closed 6 years ago

Aissa-H commented 6 years ago

Hi @trapacska, thank you a lot for this step, it will significantly improve my CI workflow! :+1:

I tried a test which needs the location of the device. In the code of the app, I use the FusedLocationProviderClient class provided by the Google Location API. I also use a GoogleMap object to display the map in my fragment.

Unfortunately, neither the retrieving of the location nor the map are working as I can see in the video result.

Coarse, on the top on my test, I use a permission rule to allow the location permission as follow:

@Rule public GrantPermissionRule grantPermissionRule =
      GrantPermissionRule.grant(Manifest.permission.ACCESS_FINE_LOCATION);

The tests runs correctly on real devices.

I think this is maybe a problem of installation of Google Play Services on the virtual devices, what do you think?

Thank you in advance! :v:

trapacska commented 6 years ago

Hey @Aissa-H! 👋

As far as I know, on emulator you will need to use mock/test provider.

Here is an example: https://stackoverflow.com/questions/1972895/testing-gps-in-android/3940877#3940877

I think if you try it your test on an emulator on your local PC, it should behave the same as you described.

Closing the issue now, as it is not an exact issue with the step itself. Please feel free to find me on our http://discuss.bitrise.io site, or the on-site chat.

Hope this helps! 🚀