activity_recognition 0.1.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 50

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="" />

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';


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

0.0.1 #

  • First working prototype for Android and iOS.


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

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

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

class _MyAppState extends State<MyApp> {
  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 =;
                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:

  activity_recognition: ^0.1.3

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub 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';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.9+1
  • Flutter: 1.17.3

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:activity_recognition/activity_recognition.dart]

Package does not support Flutter platform macos

Because of import path [package:activity_recognition/activity_recognition.dart]

Package does not support Flutter platform web

Because of import path [package:activity_recognition/activity_recognition.dart]

Package does not support Flutter platform windows

Because of import path [package:activity_recognition/activity_recognition.dart]

Package not compatible with SDK dart

because of import path [activity_recognition]

Maintenance issues and suggestions

Homepage URL doesn't exist. (-20 points)

At the time of the analysis the homepage field was unreachable.

Package is getting outdated. (-90.96 points)

The package was last published 99 weeks ago.


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.12 1.14.13
meta 1.1.8 1.2.0
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies