最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

React-native and expo - Check if google play services are available - Stack Overflow

programmeradmin1浏览0评论

I need to check if an android device has Google Play Services installed to avoid calling expo-location getCurrentPositionAsync (available only with google play service).

I have found how do to it in Kotlin but not a lib in react-native.

There is this one package : But it is dead for 5 years now and 0 weekly download.

Is there an alternative way to know this using RN or expo ?

Thanks for reading me.

I need to check if an android device has Google Play Services installed to avoid calling expo-location getCurrentPositionAsync (available only with google play service).

I have found how do to it in Kotlin but not a lib in react-native.

There is this one package : https://www.npmjs.com/package/react-native-play-services But it is dead for 5 years now and 0 weekly download.

Is there an alternative way to know this using RN or expo ?

Thanks for reading me.

Share Improve this question asked yesterday BaartBaart 5821 gold badge6 silver badges19 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I ended up using this package : react-native-device-info

With the function

import DeviceInfo from 'react-native-device-info';

async function checkGooglePlayServices() {
  const isPlayServicesAvailable = await DeviceInfo.hasGms(); // Returns true if Google Play Services are available
  return isPlayServicesAvailable;
}

It does detect correctly with emulated non google android phone.

https://github.com/react-native-device-info/react-native-device-info?tab=readme-ov-file#hasGms

发布评论

评论列表(0)

  1. 暂无评论