android_os_build 0.1.0 copy "android_os_build: ^0.1.0" to clipboard
android_os_build: ^0.1.0 copied to clipboard

retracted

Easily retrieve information about the current Android build synchronously. Built with dart's experimental jni

Easily retrieve information about the current Android build synchronously.

Important

This package is currently experimental and may change in non-breaking ways in the future. version 0.X.X still in development and may not ready for production use.

Example #

install example app

cd example
flutter pub get
flutter build apk --target-platform android-arm64
flutter install --release

Usage #

API Documentation

Add package #

  • run in command line
flutter pub add android_os_build
  • or add to pubspec.yaml
...
dependencies:
  android_os_build: any
...

Get build information #

import 'package:android_os_build/android_os_build.dart';

final model = Build.model;
final sdkInt = Build.version.sdkInt;

AndroidBuild.getSerial() require android.permission.READ_PRIVILEGED_PHONE_STATE permission, so if you want to get serial number, you need to add this permission to your AndroidManifest.xml file.

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
  <uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
  ......
</manifest>

Direct use generated ffi code #

import 'package:android_os_build/android_os_build_jni.dart';

String getBoard() {
  final JString board = Build.BOARD;
  /// return value and release the string object
  return board.toDartString(releaseOriginal: true);
}

Development #

you should build apk first then run jnigen

cd example
flutter build apk
cd ..
flutter pub run jnigen --config jnigen.yaml

License #

  • package is under MIT license

The Android robot is reproduced or modified from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.

1
likes
0
points
34
downloads

Publisher

verified publisherlaihz.dev

Weekly Downloads

Easily retrieve information about the current Android build synchronously. Built with dart's experimental jni

Repository (GitHub)
View/report issues

Topics

#android #ffi #utils

License

unknown (license)

Dependencies

flutter, jni, plugin_platform_interface

More

Packages that depend on android_os_build