activity_recognition_flutter 1.2.3 copy "activity_recognition_flutter: ^1.2.3" to clipboard
activity_recognition_flutter: ^1.2.3 copied to clipboard

outdated

Activity recognition plugin for Android and iOS using the native APIs with updated Kotlin version to 1.2.51, forked from https://github.com/Morosko/flutter_activity_recognition. ActivityRecognitionCli [...]

example/lib/main.dart

import 'package:activity_recognition_flutter/activity_recognition_flutter.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> {
  Stream<Activity> stream;
  Activity latestActivity = Activity.empty();

  @override
  void initState() {
    super.initState();
    stream = ActivityRecognition.activityUpdates();
    stream.listen(onData);
  }

  void onData(Activity activity) {
    setState(() {
      latestActivity = activity;
    });
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Activity Recognition Example'),
        ),
        body: new Center(
          child: Text(latestActivity.toString()),
        ),
      ),
    );
  }
}
62
likes
0
points
349
downloads

Publisher

verified publishercachet.dk

Weekly Downloads

Activity recognition plugin for Android and iOS using the native APIs with updated Kotlin version to 1.2.51, forked from https://github.com/Morosko/flutter_activity_recognition. ActivityRecognitionClient on Android, CoreMotion on iOS.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on activity_recognition_flutter