Git Product home page Git Product logo

nearit / react-native-connectivity-status Goto Github PK

View Code? Open in Web Editor NEW
38.0 9.0 26.0 45 KB

A ReactNative module to check Bluetooth and Location status on Android and iOS

Home Page: https://www.npmjs.com/package/react-native-connectivity-status

License: MIT License

Java 47.91% JavaScript 4.79% Objective-C 41.88% Ruby 5.43%
react-native react-native-android react-native-ios connectivity bluetooth location-services location

react-native-connectivity-status's People

Contributors

awhite avatar federicoboschini avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-connectivity-status's Issues

IOS build issue

Environment

System:
OS: macOS 10.14.6
CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
Memory: 91.46 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.15.3 - /usr/local/bin/node
Yarn: 1.16.0 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
Android SDK:
API Levels: 23, 25, 28
Build Tools: 27.0.3, 28.0.3
System Images: android-25 | Intel x86 Atom, android-25 | Intel x86 Atom_64, android-25 | Google APIs ARM 64 v8a, android-25 | Google APIs ARM EABI v7a, android-25 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom_64, android-25 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5522156
Xcode: 10.3/10G8 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.5 => 0.60.5

Steps to Reproduce

1.yarn add react-native-connectivity-status
2.react-native link react-native-connectivity-status
3.cd ios && pod install
4.react-native run-ios

Expected Behavior

app run successfully

Actual Behavior

-'RNConnectivityStatus' cannot use 'super' because it is a root class.
-Class 'RNConnectivityStatus' defined without specifying a base class.
-No visible @interface for 'RNConnectivityStatus' declares the selector 'sendEventWithName:body:'

[RN 0.49+] Module RNConnectivityStatus requires main queue setup since it overrides `init` but doesn't implement `requiresMainQueueSetup`.

Environment

Environment:
OS: macOS Sierra 10.12.6
Node: 9.4.0
Yarn: 1.3.2
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.52.0 => 0.52.0

Target Platforms:
Android: 5.1 (API 22)
iOS: 8.0

Steps to Reproduce

  1. Launch a ReactNative app containing react-native-connectivity-status on iOS.

Expected Behavior

No warning messages from React Native runtime.

Actual Behavior

The following warning message is shown

Module RNConnectivityStatus requires main queue setup since it overrides `init` but doesn't implement `requiresMainQueueSetup`. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.

Add support for iOS 13 Bluetooth permission?

iOS 13 introduced the requirement to request permission to use Bluetooth, much like location. It would be great if this library could be used to check the status of that permission.

The library com.google.android.gms:play-services-basement is being requested by various other libraries

My project react native version is 0.57.5
react version is 16.6.0-alpha.8af6728
I am using react-native-connectivity-status for version "1.5.1".

When i install react-native-connectivity-status library and try to run android build I receive following error.

The library com.google.android.gms:play-services-basement is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 12.0.1. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

I tried following things.

compile (project(':react-native-connectivity-status')) {
exclude group: 'com.google.android.gms', module: "play-services-basement"
}

compile ("com.google.android.gms:play-services-basement:15.0.1") {
force = true
}

I am stuck in this issue please help.

on iOS 11, `enableLocation` and `enableBluetooth` don't redirect to the specific `Settings` page

on iOS 11, when calling enableLocation and enableBluetooth methods Settings app launches to the main screen, instead it should launch into the Location Services section and into the Bluetooth section respectively.

This seems to be an intended change made by Apple and there is currently no solution or workaround.

This issue will stay open until a solution is found, or until a new way to achieve the desired behaviour is found.

Bluetooth status is always TRUE in ConnectivityStatusChange event

Environment

Environment:
OS: macOS Sierra 10.12.6
Node: 9.2.1
Yarn: 1.3.2
npm: 5.5.1
Watchman: 4.7.0
Xcode: Xcode 8.3.3 Build version 8E3004b
Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed)
react: 16.0.0 => 16.0.0
react-native: 0.50.3 => 0.50.3

Target Platforms:
Android: 5.0 (API 21)
iOS: 8.0

Steps to Reproduce

  1. Subcsribe to connectivity status change events:
this._connectivityStatusChangeSubscription =
      ConnectivityManager.addStatusListener(this._handleConnectivityStatusChange);

. . .

_handleConnectivityStatusChange({ eventType, status }) {
  console.log(eventType, status);
}
  1. Turn ON | OFF Bluetooth on a device and check status values in console.

Expected Behavior

Status value should toggle between TRUE and FALSE when we turning ON | OFF Bluetooth.

Actual Behavior

Status value is always TRUE regardless of the actual Bluetooth state.

screen shot 2018-01-19 at 2 12 09 am

Cocoapod support

We use Cocapod as a package manager in our RN project (in the RN 0.60+ Cocoapods is used in all projects by default). react-native-connectivity-status doesn't contain *.podspec file so it can't be managed by Cocoapods and it creates some difficulties during project build.

Sorry, I've read your contribution guidelines after PR creation :) so I create this issue after PR (#9).

Environment

  React Native Environment Info:
    System:
      OS: macOS 10.14.6
      CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
      Memory: 66.28 MB / 16.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 12.6.0 - /usr/local/bin/node
      Yarn: 1.17.3 - /usr/local/bin/yarn
      npm: 6.9.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
      Android SDK:
        API Levels: 23, 26, 28
        Build Tools: 23.0.1, 26.0.1, 27.0.3, 28.0.3
        System Images: android-28 | Google APIs Intel x86 Atom
    IDEs:
      Xcode: 10.3/10G8 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3
      react-native: 0.59.10 => 0.59.10
    npmGlobalPackages:
      create-react-native-module: 0.5.0
      react-native-cli: 2.0.1
      react-native-create-library: 3.1.2

Target Platforms:
iOS: 10.0

Steps to Reproduce

  1. yarn add react-native-connectivity-status
  2. react-native link react-native-connectivity-status
  3. cd ios
  4. pod install

Expected Behavior

If a project contains Podfile react-native link should add a line to it.

Actual Behavior

Because the lib doesn't contain *.podspec react-native link directly changes *.xcproject file. This creates issues for Cocoapod (RN app just doesn't detect the native module on iOS).

Update Podspec for Xcode 12 Support

Environment

Environment:
OS: macOS Big Sur 11.2.2
Node: 11.10.1
Yarn: 1.19.1
npm: 6.7
Watchman: 4.7.0
Xcode: Xcode 12.4 stable
Android Studio: NA

Packages: (wanted => installed)
react-native: 0.62.2 => 0.63.4 (current stable)
react: 16.13.1

Target Platforms:
iOS 9-11

Steps to Reproduce

Xcode 12 reveals a dependency issue for React Native in the Podspec file of every native library.

See this comment here on the React Native Repo: facebook/react-native#29633 (comment) . Notice following that comment all of the repos that that feed gets mentioned in, and how they all updated this dependency thereafter.

This change, s.dependency from 'React' to 'React-Core' is needed to get this module to compile correctly with react native in Xcode 12. Without this change, Xcode 12 fails to compile the library, at least with newer version of react native.

I currently have this patch and it works with Xcode 12:
image

enableLocation() opens app's preferences even when Locaion Services are disabled

Environment

Environment:
OS: macOS Sierra 10.12.6
Node: 9.2.1
Yarn: 1.3.2
npm: 5.5.1
Watchman: 4.7.0
Xcode: Xcode 8.3.3 Build version 8E3004b
Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed)
react: 16.0.0 => 16.0.0
react-native: 0.50.3 => 0.50.3

Target Platforms:
Android: 5.0 (API 21)
iOS: 8.0

Steps to Reproduce

  1. Disable Location Services in iOS.
  2. Call ConnectivityManager.enableLocation() in the app.

Expected Behavior

OS preferences should be opened where we can enable Location Services.

Actual Behavior

App's preferences are opened, but there's no use for it, since app's Location Services permissions are not editable when Location Services are globally disabled.

Bluetooth should be optional

I think Bluetooth should be optional since not everyone wants to check the bluetooth status, only location since it's more popular.

Apple rejection "prefs:root"

Hi, we got an Apple Rejection by using this module:

"Your app uses the "prefs:root=" non-public URL scheme, which is a private entity."

Proposal resolution:

"To resolve this issue, please revise your app to provide the associated functionality using public APIs or remove the functionality using the "prefs:root" or "App-Prefs:root" URL scheme."

Can you help?
Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.