Android Question Notification with vibration

slugger

Member
Licensed User
Longtime User
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

Vibrate:
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
    12.5 KB · Views: 81

slugger

Member
Licensed User
Longtime User
Try it with:
B4X:
n.Initialize2(n.IMPORTANCE_HIGH)

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

slugger

Member
Licensed User
Longtime User
Is the app in the background?

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
Top