Giter Site home page Giter Site logo

drydart / flutter_android Goto Github PK

View Code? Open in Web Editor NEW
131.0 9.0 21.0 1.05 MB

Android bindings plugin for Flutter.

Home Page: https://pub.dev/packages/flutter_android

License: The Unlicense

Makefile 0.04% Java 11.00% Ruby 0.82% Swift 0.34% Objective-C 0.27% Dart 87.54%
flutter flutter-plugin dart-library android face-detection

flutter_android's Introduction

Flutter Android Bindings

Project license Dart compatibility Pub package Dartdoc reference

This is a Flutter plugin for using Android's numerous platform-specific APIs in Flutter apps.

Screenshot

Screenshot of Android settings

Prerequisites

Compatibility

Android only.

Installation

dependencies:
  flutter_android: ^0.8.0

Features

  • Implements bindings to a growing set of Android's platform-specific APIs.

  • Reduces duplication of effort by centralizing Android bindings in a single package.

Feature Table

Feature Flutter API
Activity launch android_content.Intent#startActivity()
Bluetooth scanning android_bluetooth.BluetoothLeScanner
Distance calculation android_location.Location.distanceBetween()
Face detection android_media.FaceDetector
Heart-rate monitoring android_hardware.SensorManager.getDefaultSensor()
Parcel serialization android_os.Parcel
Sensor event streams android_hardware.Sensor#subscribe()

TODO: dirs

Examples

Activity launch

import 'package:flutter_android/android_content.dart' show Intent;

await Intent(
  action: "android.intent.action.VIEW", // Intent.ACTION_VIEW
  data: Uri.parse("https://flutter.dev"),
).startActivity();

Parcel serialization

import 'package:flutter_android/android_os.dart' show Parcel;

var parcel = Parcel.obtain()
  ..writeBoolean(true)
  ..writeInt(42)
  ..writeDouble(3.1415)
  ..writeString("Hello, world!")
  ..writeList(<Object>[1, 2, 3])
  ..writeMap(<String, Object>{"a": 1, "b": 2, "c": 3});

await _channel.invokeMethod('someJavaMethod', parcel.asUint8List());

// In Java, your MethodCallHandler's call.arguments contains the marshaled Parcel

Face detection

import 'package:flutter_android/android_graphics.dart' show Bitmap;
import 'package:flutter_android/android_media.dart' show Face, FaceDetector;

var photo = Image.asset("images/einstein.png");

var bitmap = Bitmap.fromAssetImage(photo.image as AssetImage);
var detector = FaceDetector(width: 280, height: 396);

for (var face in await detector.findFaces(bitmap)) {
  if (face.confidence < Face.CONFIDENCE_THRESHOLD) {
    continue; // skip dubious results below the cut-off threshold
  }
  print("Found a face at (${face.midPoint.x}, ${face.midPoint.y}) with confidence ${face.confidence}");
}

Heart-rate monitoring

import 'package:flutter_android/android_hardware.dart'
    show Sensor, SensorEvent, SensorManager;

var sensor = await SensorManager.getDefaultSensor(Sensor.TYPE_HEART_RATE);

var events = await sensor.subscribe();
events.listen((SensorEvent event) {
  print(event.values[0]);
});

Frequently Asked Questions

TODO

Caveats

  • iOS is not and cannot be supported. All flutter_android APIs throw an AssertionError if they are invoked when running on iOS. For cross-platform apps, we recommend that you depend on the platform package to conditionalize your use of Android APIs.

Reference

import 'package:flutter_android/android.dart' as android;
import 'package:flutter_android/android_app.dart' as android_app;
import 'package:flutter_android/android_bluetooth.dart' as android_bluetooth;
import 'package:flutter_android/android_content.dart' as android_content;
import 'package:flutter_android/android_database.dart' as android_database;
import 'package:flutter_android/android_graphics.dart' as android_graphics;
import 'package:flutter_android/android_hardware.dart' as android_hardware;
import 'package:flutter_android/android_location.dart' as android_location;
import 'package:flutter_android/android_media.dart' as android_media;
import 'package:flutter_android/android_os.dart' as android_os;

Cross-Reference

Android Flutter
android.app android_app
android.app.Activity android_app.Activity
android.app.ActivityManager android_app.ActivityManager
android.app.AlarmManager android_app.AlarmManager
android.app.AuthenticationRequiredException android_app.AuthenticationRequiredException
android.app.DownloadManager android_app.DownloadManager
android.app.KeyguardManager android_app.KeyguardManager
android.app.Notification android_app.Notification
android.app.Notification.Action android_app.NotificationAction
android.app.Notification.Builder android_app.NotificationBuilder
android.app.NotificationManager android_app.NotificationManager
android.app.PendingIntent android_app.PendingIntent
android.app.SearchManager android_app.SearchManager
android.app.WallpaperColors android_app.WallpaperColors
android.app.WallpaperInfo android_app.WallpaperInfo
android.app.WallpaperManager android_app.WallpaperManager
android.bluetooth android_bluetooth
android.bluetooth.BluetoothAdapter android_bluetooth.BluetoothAdapter
android.bluetooth.BluetoothDevice android_bluetooth.BluetoothDevice
android.bluetooth.BluetoothHeadset android_bluetooth.BluetoothHeadset
android.bluetooth.BluetoothManager android_bluetooth.BluetoothManager
android.bluetooth.le.BluetoothLeScanner android_bluetooth.BluetoothLeScanner
android.bluetooth.le android_bluetooth
android.content android_content
android.content.ActivityNotFoundException android_content.ActivityNotFoundException
android.content.ComponentName android_content.ComponentName
android.content.ContentValues android_content.ContentValues
android.content.Context android_content.Context
android.content.Intent android_content.Intent
android.content.IntentFilter android_content.IntentFilter
android.content.SharedPreferences android_content.SharedPreferences
android.database android_database
android.database.Cursor android_database.Cursor
android.database.CursorIndexOutOfBoundsException android_database.CursorIndexOutOfBoundsException
android.database.DatabaseUtils android_database.DatabaseUtils
android.database.MatrixCursor android_database.MatrixCursor
android.database.SQLException android_database.SQLException
android.graphics android_graphics
android.graphics.Bitmap android_graphics.Bitmap
android.graphics.Color dart-ui.Color
android.graphics.Point android_graphics.Point
android.graphics.PointF android_graphics.PointF
android.graphics.drawable.Icon flutter.Icon
android.hardware android_hardware
android.hardware.Sensor android_hardware.Sensor
android.hardware.SensorEvent android_hardware.SensorEvent
android.hardware.SensorEventListener android_hardware.SensorEventListener
android.hardware.SensorManager android_hardware.SensorManager
android.location android_location
android.location.Location android_location.Location
android.media android_media
android.media.FaceDetector android_media.FaceDetector
android.media.FaceDetector.Face android_media.Face
android.net android_net
android.nfc android_nfc
android.os android_os
android.os.BatteryManager android_os.BatteryManager
android.os.Build android_os.Build
android.os.Bundle android_os.Bundle
android.os.Environment android_os.Environment
android.os.HardwarePropertiesManager android_os.HardwarePropertiesManager
android.os.Parcel android_os.Parcel
android.os.Parcelable android_os.Parcelable
android.os.PowerManager android_os.PowerManager
android.os.Process android_os.Process
android.os.StatFs android_os.StatFs
android.os.SystemClock android_os.SystemClock
android.os.UserManager android_os.UserManager
android.os.VibrationEffect android_os.VibrationEffect
android.os.Vibrator android_os.Vibrator
android.provider android_provider
android.security android_security
android.speech android_speech
android.telephony android_telephony
android.view android_view
java.util.Locale dart-ui.Locale

See Also

  • The win32 package provides bindings to the most common Win32 APIs.

flutter_android's People

Contributors

artob avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter_android's Issues

Support for android receivers

Hello, I would like to know if it is possible to use a BroadcastReceiver through this package. I need to start a service related to my app after the boot is completed, so then I need to define a broadcast receiver to get informed when the boot has finished and then start the service with an Intent object. Is it possible to get this using this package? Or, should I use MethodChannel?

Well if it isn't supported, so then I am requesting this feature in this post.

I hope you can guide me. Best regards.

Use of Android PointF in Flutter

It would be nice if you can describe how to use the PointF in Flutter.

I have added this package to my project, but I'm not able to retrieve the PointF Constructure.

Thanks

Implement android_bluetooth

Issuehunt badges

Are you currently working on this? Or do you have a particular development schedule in mind?

I would like to use this functionality, but it seems like it's currently just an empty stub.


IssueHunt Summary

Backers (Total: $5.00)

Become a backer now!

Or submit a pull request to get the deposits!

Tips


IssueHunt has been backed by the following sponsors. Become a sponsor

不能平移

当通过手势放大后,不能通过平移来查看其他细节

Implement android_app.WallpaperManager

The library's WallpaperManager isn't working or I think, at the time being, it's empty. And if it isn't, then can you help me out in implementing it in my project. I want to set a wallpaper on android's homescreen using this library.

Is development of package stopped?

There is not-completed libraries, last update to package is in March 2019. Is developer left the project? I would want to see more features in this library...

Dart 3.x dependency error

Hi, any ideia on how to get this working with Dart 3.x?
pubspec:
flutter_android: ^0.8.0

C:\FlutterSDK\flutter\bin\flutter.bat --no-color pub get
Resolving dependencies...
The current Dart SDK version is 3.1.0-35.0.dev.

Because geolocation_test depends on flutter_android >=0.1.0 which doesn't support null safety, version solving failed.

The lower bound of "sdk: '>=2.0.0 <3.0.0'" must be 2.12.0 or higher to enable null safety.
For details, see https://dart.dev/null-safety
Process finished with exit code 1

Thank you

Can't use android hardware 28: TYPE_POSE_6DOF

Describe the bug
other sensors work really well as example shows, however, if I use TYPE_POSE_6DOF, the SensorManager.getDefaultSensor can't get Sensor instance.

To reproduce
Steps to reproduce the behavior:

  1. Go to 'examples Heart-rate monitoring '
  2. Change TYPE_HEART_RATE to TYPE_POSE_6DOF.
  3. Run it.
  4. See error, the variable sensor is 'null'

Expected behavior
hope to use TYPE_POSE_6DOF

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Chrome

Smartphone (please complete the following information):

  • Device: Pixel 2 (emulated by Android studio)
  • OS: [SDK 28]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.