Aminoid / react-native-activity-recognition

React Native wrapper for the Activity Recognition API.
GNU General Public License v2.0
95 stars 79 forks source link

Handle errors with Promises #4

Closed cooperka closed 7 years ago

cooperka commented 7 years ago

Motivation

Some simulators (for both iOS and Android) don't support activity recognition, and even some real Android devices don't have Google Play Services installed. For these devices, the app may crash with native error logs that never get sent to JS and thus are impossible to handle elegantly.

Changes

Example

ActivityRecognition.start(1000)
  .then(() => console.log('Success'))
  .catch((errorMsg) => console.log(errorMsg));

Notes

cooperka commented 7 years ago

Hi @Aminoid, I noticed you're not watching this repo so I wanted to ping you directly. Do you mind taking a quick look at this PR? Let me know if you want any more info!

reyalpsirc commented 7 years ago

I'll be using your fork while this isn't merged :)

Aminoid commented 7 years ago

Thanks for the pull-request @cooperka. Merged it and is available in release v3.2.0