iOS手机,在后台收到通知时不会震动吗?

huangapple go评论81阅读模式
英文:

iOS phone, notifications in background it's not vibrate?

问题

我开发Flutter项目并使用FCM和本地通知,在iOS手机处于后台时无法振动。

我的BackgroundHandler:

@pragma('vm:entry-point')
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
  await Firebase.initializeApp();
  await setupFlutterNotifications();

  showFlutterNotification(message);
}

我使用以下代码进行振动:

await Vibration.vibrate(duration: 500);
英文:

I develop flutter project and I use FCM and Local Notification I have issues when iOS phone in background it's not vibrate.

my BackgroundHandler:

@pragma(&#39;vm:entry-point&#39;)
Future&lt;void&gt; _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
  await Firebase.initializeApp();
  await setupFlutterNotifications();

  showFlutterNotification(message);
}

I use

await Vibration.vibrate(duration: 500);

to vibration.your text

答案1

得分: 1

根据我的观点,你不能这样做,因为通知的振动取决于手机设置,所以即使在手机设置中强制禁用通知振动,你也无法这样做。

更多详情,请查看这个链接,可能会有帮助。

英文:

In my opine you can't because notification vibrate is depends on phone settings so you can't do that even forcefully if notification vibration disable from phone settings.

for more details check this link it may helpful.

huangapple
  • 本文由 发表于 2023年1月9日 10:19:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/75052646.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定