I have a B4A app in use for quite some time, which has a service with Java code that includes use of the Vibrator. Below is the relevant code snippets which still works on older OS.
The Manifest has the VIBRATE permission. The IDE/Logs/ListPermissions shows
The app's service also has a notification. If I click the service's notification, which brings up an activity which allows reviewing the app's permissions, and do so, ... while on the permission review screen if I click the 'i' (information) icon for the application entry to bring up the App info page, and I click on permissions, it lists the two 'dangerous' permissions used/approved, ... and if I click the 'vertical ...' next to 'App permissions' and select 'All permissions', the page lists under 'Other app capabilities' the 'Control vibration' entry.
So it seems like it should be working, but, under 8.0 there is no vibration when the service java code is crossed. I've googled and searched in the B4X forums and haven't found success. Same device under 7.0 it did work, and another device under 6.0.1 still works.
Any ideas on what I've missed? Thank you.
B4X:
import android.os.Vibrator;
import android.os.VibrationEffect;
...
private void vibfeedback(int ms) {
if (Build.VERSION.SDK_INT >= 26) {
((Vibrator) getSystemService(Context.VIBRATOR_SERVICE)).vibrate(VibrationEffect.createOneShot(ms, VibrationEffect.DEFAULT_AMPLITUDE));
} else {
((Vibrator) getSystemService(Context.VIBRATOR_SERVICE)).vibrate(ms);
}
}
...
// and the line to invoke is
vibfeedback(150);
The Manifest has the VIBRATE permission. The IDE/Logs/ListPermissions shows
B4X:
Manifest Editor
android.permission.VIBRATE
The app's service also has a notification. If I click the service's notification, which brings up an activity which allows reviewing the app's permissions, and do so, ... while on the permission review screen if I click the 'i' (information) icon for the application entry to bring up the App info page, and I click on permissions, it lists the two 'dangerous' permissions used/approved, ... and if I click the 'vertical ...' next to 'App permissions' and select 'All permissions', the page lists under 'Other app capabilities' the 'Control vibration' entry.
So it seems like it should be working, but, under 8.0 there is no vibration when the service java code is crossed. I've googled and searched in the B4X forums and haven't found success. Same device under 7.0 it did work, and another device under 6.0.1 still works.
Any ideas on what I've missed? Thank you.