slugger Member Licensed User Longtime User Aug 12, 2024 #1 Hello, I need to have the notification make the phone to vibrate. I am enclosing a small example which does not work, the relevant code is executed (see the toast messages) but I get no vibration. In other words, the line Code: Copy not1.Vibrate=True seems to do nothing. Any other reliable ways to make the phone vibrate at will up to Android 14? Steve Attachments Notivibro.zip Notivibro.zip 12.5 KB · Views: 388
Hello, I need to have the notification make the phone to vibrate. I am enclosing a small example which does not work, the relevant code is executed (see the toast messages) but I get no vibration. In other words, the line Code: Copy not1.Vibrate=True seems to do nothing. Any other reliable ways to make the phone vibrate at will up to Android 14? Steve
Erel B4X founder Staff member Licensed User Longtime User Aug 13, 2024 #2 Try it with: Code: Copy n.Initialize2(n.IMPORTANCE_HIGH) Upvote 0
slugger Member Licensed User Longtime User Aug 13, 2024 #3 Erel said: Try it with: Code: Copy n.Initialize2(n.IMPORTANCE_HIGH) Click to expand... Thanks for your reply but it doesn't work. The only effect now is that as soon as I click the button the notification automatically opens at the top of the screen and closes itself after 5 seconds. Still no vibration on both an Oppo running Android 13 and a Xiaomi on Android 14. I don't really need a notification, all I need is a method to make the phone vibrate under certain circumstances, like when my app receives some kind of data. I have tried the PhoneVibrate option, it works on Android 13 but not on Android 14. Anyone can lead me to a reliable way to make the phone vibrate on both Android 13 and 14 ? Steve Upvote 0
Erel said: Try it with: Code: Copy n.Initialize2(n.IMPORTANCE_HIGH) Click to expand... Thanks for your reply but it doesn't work. The only effect now is that as soon as I click the button the notification automatically opens at the top of the screen and closes itself after 5 seconds. Still no vibration on both an Oppo running Android 13 and a Xiaomi on Android 14. I don't really need a notification, all I need is a method to make the phone vibrate under certain circumstances, like when my app receives some kind of data. I have tried the PhoneVibrate option, it works on Android 13 but not on Android 14. Anyone can lead me to a reliable way to make the phone vibrate on both Android 13 and 14 ? Steve
Erel B4X founder Staff member Licensed User Longtime User Aug 14, 2024 #4 Is the app in the background? If it is in the foreground then you can use XUIViewsUtils.PerformHapticFeedback Upvote 0
Is the app in the background? If it is in the foreground then you can use XUIViewsUtils.PerformHapticFeedback
slugger Member Licensed User Longtime User Aug 14, 2024 #5 Erel said: Is the app in the background? Click to expand... Yes. Imagine you have your phone in your pocket, screen is off. You receive a phone call and your phone sends out a sound alert AND it starts vibrating. I need exactly the same. I have an app which rests in the background waiting for some data fetched from a server, when the data arrive they are managed and under certain circumstances the app sends out a sound alarm, a vibration or both depending on the settings chosen by the user. Up to Android 13 the PhoneVibrate was working fine, unfortunately under Android 14 the phone does not vibrate anymore while the sound alert is sent out regularly. I gave Notifications a try hoping it would solve the issue but it is not working. Upvote 0
Erel said: Is the app in the background? Click to expand... Yes. Imagine you have your phone in your pocket, screen is off. You receive a phone call and your phone sends out a sound alert AND it starts vibrating. I need exactly the same. I have an app which rests in the background waiting for some data fetched from a server, when the data arrive they are managed and under certain circumstances the app sends out a sound alarm, a vibration or both depending on the settings chosen by the user. Up to Android 13 the PhoneVibrate was working fine, unfortunately under Android 14 the phone does not vibrate anymore while the sound alert is sent out regularly. I gave Notifications a try hoping it would solve the issue but it is not working.
Erel B4X founder Staff member Licensed User Longtime User Aug 15, 2024 #6 I guess that notification is your only option and you will need to check your device settings and find out why the vibration doesn't work. Better to use NB6 to create the notifications. Upvote 0
I guess that notification is your only option and you will need to check your device settings and find out why the vibration doesn't work. Better to use NB6 to create the notifications.