![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
rn-motion-activity
Advanced tools
React Native wrapper for the Android Activity Recognition API and CMMotionActivity. It attempts to determine the user activity such as driving, walking, running and cycling. Possible detected activities for android are listed here and for iOS are listed here.
npm i -S react-native-activity-recognition
or with Yarn:
yarn add react-native-activity-recognition
react-native link react-native-activity-recognition
IMPORTANT NOTE: You'll need to follow Step 4 for both iOS and Android of manual-linking
Make alterations to the following files in your project:
android/settings.gradle
...
include ':react-native-activity-recognition'
project(':react-native-activity-recognition').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-activity-recognition/android')
...
android/app/build.gradle
...
dependencies {
...
compile project(':react-native-activity-recognition')
...
}
android/app/src/.../MainApplication.java
import com.xebia.activityrecognition.RNActivityRecognitionPackage; // <--- add import
public class MainApplication extends Application implements ReactApplication {
// ...
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
// ...
new RNActivityRecognitionPackage() // <--- add package
);
}
android/app/src/main/AndroidManifest.xml
...
<application ...>
...
<service android:name="com.xebia.activityrecognition.DetectionService"/>
...
</application>
...
Add Files to <...>
node_modules
➜ react-native-activity-recognition
➜ ios
➜ select RNActivityRecognition.xcodeproj
RNActivityRecognition.a
to Build Phases -> Link Binary With Libraries
NSMotionUsageDescription
key to your Info.plist
with strings describing why your app needs this permissionimport ActivityRecognition from 'react-native-activity-recognition'
...
// Subscribe to updates
this.unsubscribe = ActivityRecognition.subscribe(detectedActivities => {
const mostProbableActivity = detectedActivities.sorted[0]
})
...
// Start activity detection
const detectionIntervalMillis = 1000
ActivityRecognition.start(detectionIntervalMillis)
...
// Stop activity detection and remove the listener
ActivityRecognition.stop()
this.unsubscribe()
detectedActivities
is an object with keys for each detected activity, each of which have an integer percentage (0-100) indicating the likelihood that the user is performing this activity. For example:
{
ON_FOOT: 8,
IN_VEHICLE: 15,
WALKING: 8,
STILL: 77
}
Additionally, the detectedActivities.sorted
getter is provided which returns an array of activities, ordered by their
confidence value:
[
{ type: 'STILL', confidence: 77 },
{ type: 'IN_VEHICLE', confidence: 15 },
{ type: 'ON_FOOT', confidence: 8 },
{ type: 'WALKING', confidence: 8 },
]
Because the activities are sorted by confidence level, the first value will be the one with the highest probability Note that ON_FOOT and WALKING are related but won't always have the same value. I have never seen WALKING with a higher confidence than ON_FOOT, but it may happen that WALKING comes before ON_FOOT in the array if they have the same value.
The following activity types are supported:
detectedActivities
is an object with key to the detected activity with a confidence value for that activity given by CMMotionActivityManager. For example:
{
WALKING: 2
}
detectedActivities.sorted
getter will return it in the form of an array.
[
{type: "WALKING", confidence: 2}
]
The following activity types are supported:
The following projects were very helpful in developing this library:
FAQs
React Native wrapper for the Activity Recognition API.
The npm package rn-motion-activity receives a total of 0 weekly downloads. As such, rn-motion-activity popularity was classified as not popular.
We found that rn-motion-activity demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.