benjamindean / flutter_vibration

Handle vibration on iOS and Android in Flutter apps
229 stars 69 forks source link

Vibration not work on my device (Android version 9 / Pie) #28

Closed rrifafauzikomara closed 4 years ago

rrifafauzikomara commented 4 years ago

Steps to Reproduce

  1. Add vibration: ^1.2.4 to pubspec.yaml.

  2. Add permission on the AndroidManifest.xml (main)

  3. Add an example like below:

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

void main() => runApp(VibratingApp());

class VibratingApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: AppBar( title: const Text('Vibration Plugin example app'), ), body: Builder(builder: (BuildContext context) { return Center( child: Column( children: [ RaisedButton( child: Text('Vibrate for default 500ms'), onPressed: () { Vibration.vibrate(); }, ), RaisedButton( child: Text('Vibrate for 1000ms'), onPressed: () { Vibration.vibrate(duration: 1000); }, ), RaisedButton( child: Text('Vibrate with pattern'), onPressed: () { final snackBar = SnackBar( content: Text( 'Pattern: wait 0.5s, vibrate 1s, wait 0.5s, vibrate 2s, wait 0.5s, vibrate 3s, wait 0.5s, vibrate 0.5s'), );

                  Scaffold.of(context).showSnackBar(snackBar);
                  Vibration.vibrate(
                      pattern: [500, 1000, 500, 2000, 500, 3000, 500, 500]);
                },
              )
            ],
          ),
        );
      })),
);

} }

4. Run the Apps (But `vibration` not working on my `device`)
5. Here my flutter doctor result

[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.15.2 19C57, locale en-US) • Flutter version 1.12.13+hotfix.8 at /Users/rrifafauzikomara/Documents/flutter • Framework revision 0b8abb4724 (3 months ago), 2020-02-11 11:44:36 -0800 • Engine revision e1e6ced81d • Dart version 2.7.0

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3) • Android SDK at /Users/rrifafauzikomara/Library/Android/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 29.0.3 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.4.1, Build version 11E503a • CocoaPods version 1.8.4

[✓] Android Studio (version 3.6) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 45.1.1 • Dart plugin version 192.7761 • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] VS Code (version 1.39.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.5.1

[✓] Connected device (1 available) • SM A600G • 5200e3e7f01e45f3 • android-arm • Android 9 (API 28)

• No issues found!

rrifafauzikomara commented 4 years ago

This is my phone hardware problem