activity_recognition 0.1.3

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 79

activity_recognition

pub package

Activity recognition plugin for Android and iOS. Only working while App is running (= not terminated by the user or OS).

Getting Started

Check out the example directory for a sample app using activity recognition.

Android Integration

Add permission to your Android Manifest:

<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />

Add the plugin service:

<service android:name="at.resiverbindet.activityrecognition.activity.ActivityRecognizedService" />

iOS Integration

An iOS app linked on or after iOS 10.0 must include usage description keys in its Info.plist file for the types of data it needs. Failure to include these keys will cause the app to crash. To access motion and fitness data specifically, it must include NSMotionUsageDescription.

Flutter Integration

import 'package:activity_recognition/activity_recognition.dart';

ActivityRecognition.activityUpdates()

Flutter help

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

0.1.3

  • Fix copy & paste bug

0.1.2

  • Always clear shared preferences to trigger changed event
  • Use named shared preferences to not interfere with the application itself
  • Set the interval to 30 seconds
  • Add Activity.empty()

0.1.0

  • Unify platform code

0.0.2

  • Fix stuff for pub.dartlang.org

0.0.1

  • First working prototype for Android and iOS.

example/lib/main.dart

import 'package:activity_recognition/activity_recognition.dart';
import 'package:flutter/material.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Plugin example app'),
        ),
        body: new Center(
          child: StreamBuilder(
            builder: (context, snapshot) {
              if (snapshot.hasData) {
                Activity act = snapshot.data;
                return Text("Your phone is to ${act.confidence}% ${act.type}!");
              }

              return Text("No activity detected.");
            },
            stream: ActivityRecognition.activityUpdates(),
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  activity_recognition: ^0.1.3

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:activity_recognition/activity_recognition.dart';
  
Version Uploaded Documentation Archive
0.1.3 Aug 4, 2018 Go to the documentation of activity_recognition 0.1.3 Download activity_recognition 0.1.3 archive
0.1.2 Aug 4, 2018 Go to the documentation of activity_recognition 0.1.2 Download activity_recognition 0.1.2 archive
0.1.1 Aug 3, 2018 Go to the documentation of activity_recognition 0.1.1 Download activity_recognition 0.1.1 archive
0.1.0 Aug 3, 2018 Go to the documentation of activity_recognition 0.1.0 Download activity_recognition 0.1.0 archive
0.0.2 Aug 3, 2018 Go to the documentation of activity_recognition 0.0.2 Download activity_recognition 0.0.2 archive
0.0.1 Aug 2, 2018 Go to the documentation of activity_recognition 0.0.1 Download activity_recognition 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
58
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
79
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7
  • Flutter: 1.0.0

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test