Reputation: 407
I'm doing calling feature in Flutter and I need to know whether user wants to listen with earpeace and turn off the screen, set audio output to earpeace. Is there a sensor to know if phone is close to face/ear to turn off the screen ?
Upvotes: 4
Views: 1907
Reputation: 26
The only package that worked and actually turned off the screen on proximity is the flutter_incall package like this:
IncallManager().turnScreenOff();
IncallManager().turnScreenOn();
The problem is that this package is so old and missing so many modern flutter updates like null-safety and Android embedding 2.0.
I tried using wakelock as many suggested, but the functionality is different from what I am looking for.
Upvotes: 0