Reputation: 11
https://github.com/flutter/flutter/issues/25971 In the GitHub thread, the community has managed to adjust the sample rate for android devices. My problem is that I'm building a web application using the "sensors_plus" flutter package and I can't seem to locate anywhere in the library/package where a sample rate / refresh rate for sensor data is set for the web build?
Does anyone know anything about this? is it even possible to adjust the sample rate when building for web with this package?
Sorry for the intricate question :)
Upvotes: 1
Views: 1047
Reputation: 21
Yes,it is possible. I myself have changed the package files to set the sample rate to SENSOR_DELAY_FASTEST.
Steps:
Expand the External Libraries directory present in your project directory in android studio(Only seen in android studio).
Go to flutter plugins and expand the sensors-plus->android->src.main->kotlin.dev.fluttercommunity.plus.sensors directory.
Go to StreamHandlerImpl.kt file and find the SENSOR_DELAY_NORMAL line and change it to SENSOR_DELAY_FASTEST.
Go to AndroidManifest.xml and paste this
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.fluttercommunity.plus.sensors" >
<uses-permission
android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS"/>
</manifest>
Now it will work,but this change should be done everytime you do pub get or clean your pub-cache.
Upvotes: 2