npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-play-services

v1.0.4

Published

Use Google Play Services API in React Native.

Downloads

413

Readme

react-native-play-services

NPM LICENSE Stars Actions Status

사용하기 전에

이 라이브러리는 React Native 0.60.5+ 버전에서 만들어졌습니다. 이하 버전에 대해 정상 동작을 보장할 수 없습니다. 버전을 0.60.5 이상으로 업그레이드한 후 사용하시는 것을 권장합니다.

React Native 공식 문서 - Upgrading to new React Native versions

소개

React Native에서 Google Play Services API를 사용할 수 있는 라이브러리입니다.

기능

  • Google Play Services를 사용할 수 있는지 검사하기
  • Google Play Services를 활성화할 수 있는 설정 페이지로 이동
  • Google Play Services를 업데이트할 수 있는 Play Store 링크로 이동

설치

npm 혹은 yarn을 이용한 설치

$ npm install react-native-play-services --save

혹은,

$ yarn add react-native-play-services

수동 설치 (자동 설치가 안 될 시)

  1. android/app/src/main/java/[...]/MainApplication.java 파일을 엽니다.
  • 파일 최상단에 import io.humanscape.opensources.playservices.PlayServicesPackage; 를 작성합니다.
  • getPackages() 메서드에서 반환하는 배열 안에 new PlayServicesPackage()를 추가합니다.
  1. android/settings.gradle에 아래 구문을 추가합니다.
    include ':react-native-play-services'
    project(':react-native-play-services').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-play-services/android')
  2. 아래 구문을 android/app/build.gradle 파일의 dependencies 스코프 안에 추가합니다.:
      compile project(':react-native-play-services')

API

import PlayServices from 'react-native-play-services';

// Full-set API

PlayServices.sync();


// Customizable API

(async () => {
  const status = await PlayServices.checkPlayServicesStatus();
  switch (status) {
    case PlayServices.GooglePlayServicesStatus.GMS_DISABLED:
      PlayServices.goToSetting();
      break;
    // handle anything.
  }
})();
  • Constants

    • GooglePlayServicesStatus
      • GooglePlayServicesStatus.AVAILABLE
        • Google Play Services API를 사용할 수 있습니다.
      • GooglePlayServicesStatus.GMS_DISABLED
        • Google Play Services가 비활성화되어 있습니다.
        • 설정에서 활성화를 해주어야 합니다.
      • GooglePlayServicesStatus.GMS_NEED_UPDATE
        • Google Play Services를 업데이트해야 합니다.
        • Play Store에서 업데이트를 진행해야 합니다.
      • GooglePlayServicesStatus.INVALID
        • Google Play Services의 상태를 알 수 없습니다.
  • Functions

    • sync()
      •   sync: (params: { onGmsDisabled?: () => {}, onGmsNeedUpdate?: () => {} }) => Promise<void>;
      • Google Play Services 상태를 최신으로 유지하는 동작을 실행합니다.
      • onGmsDisabled가 없을 시, goToSettings() 함수를 실행합니다.
      • onGmsNeedUpdate가 없을 시 goToMarket() 함수를 실행합니다.
    • checkPlayServicesStatus()
      •   checkPlayServicesStatus: () => Promise<GooglePlayServicesStatus>;
      • Google Play Services 상태를 체크하고, GooglePlayServicesStatus를 반환합니다.
    • goToSetting()
      •   goToSetting: () => Promise<void>;
      • Google Play Services를 활성화할 수 있는 앱 설정으로 진입합니다.
    • goToMarket()
      •   goToMarket: () => Promise<void>;
      • Google Play Services를 업데이트할 수 있는 Play Store 링크를 엽니다.