Android Question PhoneVibrate and Android 14

slugger

Member
Licensed User
Longtime User
Hi,

using B4A 12.80 and Phone library 2.53.

In one of my apps I declare the following:

B4X:
Dim pv As PhoneVibrate

and then later:

B4X:
pv.Vibrate(800)

A customer said it was working fine on a Xiaomi running Android 13.

Recently he upgraded to Android 14 and the vibration hasn't worked since.

To make sure the code was executed I made a test version of the app with the following code:

B4X:
pv.Vibrate(800)
ToastMessageShow("Vibration ON",True)

He told me the Toastmessage appears on the screen but the phone does not vibrate.

Any hints?

I need to have the phone vibrate under specific circumstances, say when the clock strikes 11:35...are there alternatives?
 

slugger

Member
Licensed User
Longtime User
Thanks for your reply.

It will not work when your app is not in the foreground. You need to use StartReceiverAt and show a notification. The notification will cause the phone to vibrate.

Do you mean that I can't issue a vibrate command at will inside a service?

The 11:35 case was just an example, say I want to vibrate the phone inside a service which runs in background when a new mail arrives or any other event that does not occur at a specific time...do I really need a notification to make the phone vibrate?

Why under Android 13 it was working fine and under Android 14 doesn't work anymore? Has something changed?

The very same part of the code, inside a background service, sends out a vibrate command and a sound (using MediaPlayer), the sound strikes OK while the vibration doesn't.
 
Upvote 0

BlueVision

Active Member
Licensed User
Longtime User
I can hardly call that an improvement.
It was meant sarcastic. However, there are so many odd things with newer versions. It is Google's product, so it is Google's decision to do whatever they want with it. You have unfortunally to live with it.

Easter.gif
 
Upvote 0
Top