「Flutter/外部ライブラリ/vibrate」の版間の差分
提供: 初心者エンジニアの簡易メモ
(/* vibrate` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod...) |
(→サンプル) |
||
(同じ利用者による、間の2版が非表示) | |||
行10: | 行10: | ||
==サンプル== | ==サンプル== | ||
+ | <pre> | ||
import 'package:vibrate/vibrate.dart'; | import 'package:vibrate/vibrate.dart'; | ||
+ | bool canVibrate = await Vibrate.canVibrate; | ||
+ | Vibrate.vibrate(); | ||
+ | final Iterable<Duration> pauses = [ | ||
+ | const Duration(milliseconds: 100), | ||
+ | ]; | ||
+ | Vibrate.vibrateWithPauses(pauses); | ||
+ | </pre> | ||
==java.lang.SecurityException: Requires VIBRATE permissionエラーの場合== | ==java.lang.SecurityException: Requires VIBRATE permissionエラーの場合== | ||
− | AndroidManifest.xmlに以下を追加 | + | android/app/src/main/AndroidManifest.xmlに以下を追加 |
<uses-permission | <uses-permission | ||
android:name="android.permission.VIBRATE"></uses-permission> | android:name="android.permission.VIBRATE"></uses-permission> |
2019年12月1日 (日) 18:31時点における最新版
目次
- 1 vibrateとは
- 2 インストール
- 3 サンプル
- 4 java.lang.SecurityException: Requires VIBRATE permissionエラーの場合
- 5 vibrate` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.エラーの場合
vibrateとは
バイブ・振動のライブラリ
インストール
pubspec.yaml
dependencies: vibrate: any
サンプル
import 'package:vibrate/vibrate.dart'; bool canVibrate = await Vibrate.canVibrate; Vibrate.vibrate(); final Iterable<Duration> pauses = [ const Duration(milliseconds: 100), ]; Vibrate.vibrateWithPauses(pauses);
java.lang.SecurityException: Requires VIBRATE permissionエラーの場合
android/app/src/main/AndroidManifest.xmlに以下を追加
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
vibrate` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.エラーの場合
https://qiita.com/ko2ic/items/f082f07df8a2aca6beed ここら辺やったが治らず。