I'm developing a game that uses vibration for the Xbox controller. It works fine on PC using Input.start_joy_vibration(), but when I'm testing it on an Android device it just doesn't work.
I tried to check the permissions and stuff like that, but none of them worked.
PS: I'm trying to vibrate the controller, not the device on Android!
For Android, you need to use Input.vibrate_handheld:
var duration_ms := 500
Input.vibrate_handheld(duration_ms)
Related
I'm trying to overcome a challenge of controlling my soundbar volume from my Mac. No volume sync alternatives are available, I tried them all so all the hope lays within this idea:
My soundbar volume can be controlled from an android/iOS app connected to the soundbar over wifi.
My plan is to have a android app simulator running and somehow bind volume keys to control the volume slider in the app. It sounds difficult so before I start trying I wanted to ask whether those things are at all possible:
Connecting the soundbar using app running on the android simulator via Wifi
Binding volume keys on my Mac to control the touch input of the android app emulator
If you have other ideas like using an actual phone and controlling its touch input I'm open to suggestion as I have some android phones laying around
recently i've found this plugin can preview many device of Android or iOS device in one installed apps,
gif of the plugin is at https://github.com/aloisdeniel/flutter_device_preview
does react native has something like this?
I know there's some similar plugin like Expo and Appetize but i need something like this,
i mean i can preview of many device in my apps, not installing my app on many devices.
I think Apptize seems to be the most similar option available.
flutter_device_preview is certainly a more practical/simple solution. You change the parameters or device, the app is rendered instantaneously. However, it provides a first-order approximation, as said in flutter_device_preview repo:
Think of Device Preview as a first-order approximation of how your app
looks and feels on a mobile device. With Device Mode you don't
actually run your code on a mobile device. You simulate the mobile
user experience from your laptop, desktop or tablet.
But with Apptize you will be able to run a native app, with no approximations, using a the true mobile-OS on any PC/Mac/Linux OS via web. But of course, has some limitations (currently 7 devices only), and has another purpose.
Here you can generate an iframe to start the testing:
https://appetize.io/docs#embed-your-app
I am working on an android (and IOS) application, the application plays audio messages without problem. My problem is as follow:
if the mobile is already connected to bluetooth (bluetooth enabled and connected), if then I launch my application and I play an audio file in this case I hear nothing neither on the telephine nor on the bluetooth speaker.
But, if I launch my application and then I activate the bluetooth,then play the audio file, there is no problem, the sound goes out well on my bluetooth speakers.
The solution I used for now is that when I launch my application I disable completely the bluetooth and then I restart it on the onDeviceready (using a plugin cordova) it works fin like that but it is not ideal as solution, it is very annoying for the users that the bluetooth disconnect and reconnect especially when it is the bluetooth of the car.
Does anyone have the same problem and can you help me find another solution.
I use the latest versions of Cordova (7.0.1), android (6.2.3) ...
and I use the plugova cordova-plugin-bluetoothle to restart bluetooth (disable then enable after the launch of the application)
Any Idea please?
Exact same problem here! I'm working on a musical webapp for Android (6.4.0) and iOS (4.5.3) built with Cordova (7.1.0). I use the webaudio API to play sounds. Everything works great on every platforms except in this specific case:
If the bluetooth is enabled and connected before I launch my App there is no sounds at all playing. This problem occurs only on Android. On some model/type of Android devices it works, on some others it doesn't... Example:
Samsung J3 (Android v5.1.1) = no sounds playing
LENOVO TB2 (Android v5.1.1) = no sounds playing
HUAWEI VTR (Android v7.0) = no sounds playing
LG G6 (Android v7.0) = it works like a charm!
Unfortunately I didn't find any 'clean' solutions yet. I do the same than yours (BT=bluetooth):
force to disable BT if this one is connected,
reload the entire page,
re-connect the BT.
The only hint I found during my tests is about an attribute into the AudioContext object. The AudioContext object has a attribute called baseLatency. The official DOC isn't really clear about it:
This represents the number of seconds of processing latency incurred by the AudioContext passing the audio from the AudioDestinationNode to the audio subsystem [...]
What I understood is that this property give you an estimation (in seconds) of the time/delay needed by AudioContext to bring a sound to his destination...
Right after the AudioContext has been initialized in your code, you can ask for this baseLatency (read-only property):
var context = new AudioContext();
console.log(context.baseLatency);// 0.008 for example
What I noticed during my tests, is that this baseLatency is always higher than 0.2 everytime the problem occurs.
Example with bluetooth DISabled:
// baseLatency on computer = 0.008
// baseLatency on iOS devices = 0.05
// baseLatency on Android devices = 0.05
Example with bluetooth ENabled:
// baseLatency on computer = 0.008 (same)
// baseLatency on iOS devices = 0.05 (same)
// baseLatency on (some) Android devices = 0.2 (HIGHER)
Well, I did this test hundreds times, each times the same result. If BT is enabled before you launch the App on some Androids devices, the baseLatency will be higher than 0.2 meaning the AudioContext won't be able to play any sounds in your app. This is not a solution I know, but that can helps a little by letting you know for sure if the App will play sounds or not.
I tried to re-initialize the AudioContext object, but this doesn't works at all... the baseLatency stay the same even if you reconstruct the AudioContext object.
I hope this tiny hint could help us to find a solution!
I have a problem when trying to implement HFP client. Usually the android phone works as HFP ag role. But I want to make my android device work as the HF role, such as a normal headset. It seems that Google has added the HFP client code but I failed to make it. Now the A2DP works well, as it works as sink. But when I tried HFP, I can hear nothing in both side. The auto car project must finish the function i want but i cant find its source code.
In addition, my test device is nexus 5 with android 5.0 and I can modify the rom if necessary.
can anyone help? Just give a abc step. Thanks a lot!
I would like some guidelines how to get device vibration working using Lua with cocos2d-x. Initially I would like a solution for Android, but eventually I require an iOS solution as well
I can see a solution here to get the vibration working in C++:
How to add vibration to cocos2d-x 3.2 on Android and iOS devices?
But I am unsure how to incorporate this solution into my Lua project so I can call the vibrate function from Lua.