Giter Club home page Giter Club logo

Comments (8)

publicBenz avatar publicBenz commented on June 23, 2024 1

It works for me after turn all of 'Setting->Sounds&Haptics->RING/SILENT MODE SWITCH' on.
#1.8.1
iOS16.7

from flutter_vibration.

benjamindean avatar benjamindean commented on June 23, 2024

Can you post any code examples?

from flutter_vibration.

byferdi42 avatar byferdi42 commented on June 23, 2024

of course

import 'dart:async';

import 'package:fluttertoast/fluttertoast.dart';
import 'package:vibration/vibration.dart';

class VibrationManager {
static VibrationManager _instance;
bool hasVibrator = false;

VibrationManager._init();

static VibrationManager get instance {
if (_instance == null) {
_instance = VibrationManager._init();
}
return _instance;
}

Future init() async {
//await Future.delayed(Duration(milliseconds: 500));
hasVibrator = await Vibration.hasVibrator();
}

void vibrate({
int duration = 500,
List pattern = const [],
int repeat = -1,
List intensities = const [],
int amplitude = -1,
}) {
if (this.hasVibrator) {
Vibration.vibrate(
duration: duration,
pattern: pattern,
repeat: repeat,
intensities: intensities,
amplitude: amplitude,
);
} else {
Fluttertoast.showToast(
msg:
"Telefonunuz Titreşimleri Desteklemiyor Bir Sonraki Güncellemeyi Bekleyebilirsiniz.",
);
}
}

void cancel() {
Vibration.cancel();
}
}

from flutter_vibration.

benjamindean avatar benjamindean commented on June 23, 2024

If you just need the device to vibrate, try without any arguments :.vibrate(). Also, hasVibrator is a Future, so it has to be awaited.

from flutter_vibration.

mano3891 avatar mano3891 commented on June 23, 2024

Yeah same for me too, I did try the await and I can see it can vibrate but then the iPhone doesn't vibrate when I do Vibrations.vibrate().

My test device is an iPhone XR running iOS 14.2.

from flutter_vibration.

mano3891 avatar mano3891 commented on June 23, 2024

Yeah same for me too, I did try the await and I can see it can vibrate but then the iPhone doesn't vibrate when I do Vibrations.vibrate().

My test device is an iPhone XR running iOS 14.2.

It is working! Sorry I had "Vibrate on Ring" option disabled in "Sound & Haptics". Once I enabled that, it started vibrating!

from flutter_vibration.

byferdi42 avatar byferdi42 commented on June 23, 2024

If you just need the device to vibrate, try without any arguments :.vibrate(). Also, hasVibrator is a Future, so it has to be awaited.

Yeah same for me too, I did try the await and I can see it can vibrate but then the iPhone doesn't vibrate when I do Vibrations.vibrate().
My test device is an iPhone XR running iOS 14.2.

It is working! Sorry I had "Vibrate on Ring" option disabled in "Sound & Haptics". Once I enabled that, it started vibrating!

I tried both but it didn't work :(

from flutter_vibration.

nohli avatar nohli commented on June 23, 2024

Another package https://pub.dev/packages/flutter_vibrate also vibrates with 'Vibrate on Ring' disabled.

Would be really nice to have this feature in this package, too.

from flutter_vibration.

Related Issues (20)

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.