plus_plugins icon indicating copy to clipboard operation
plus_plugins copied to clipboard

[Question]: UserAccelerometerEvent not working

Open RafaelFurlan20 opened this issue 1 year ago • 0 comments

What is your question?

Hello I'm making an app that collects data from all sensors, but unfotunatelly UserAccelerometerEvent is not working, the other sensors are working fine, but UserAccelerometerEvent is only working when the app is in the background. The card bellow is only updated when I leave the app and then return to it. ` DynamicCard( streamCard: StreamBuilder( stream: accelerometerEventStream(), builder: (context, snapshot) { if (snapshot.hasData) { accelerometeRawX = snapshot.data!.x; accelerometeRawY = snapshot.data!.y; accelerometeRawZ = snapshot.data!.z;

                    return Column(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Text(
                          'Accelerometer Raw Data:',
                          textAlign: TextAlign.center,
                          style: kTextStyleInnerTitleBox,
                        ),
                        Text(
                          'x: ${accelerometeRawX.toStringAsFixed(5)}',
                          style: kTextStyleInnerBodyBox,
                        ),
                        Text(
                          'y: ${accelerometeRawY.toStringAsFixed(5)}',
                          style: kTextStyleInnerBodyBox,
                        ),
                        Text(
                          'z: ${accelerometeRawZ.toStringAsFixed(5)}',
                          style: kTextStyleInnerBodyBox,
                        ),
                      ],
                    );
                  } else {
                    return Text('No data');
                  }
                },
              ),
            ),`
            

Checklist before submitting a question

  • [X] I searched issues in this repository and couldn't find such bug/problem
  • [X] I Google'd a solution and I couldn't find it
  • [X] I searched on StackOverflow for a solution and I couldn't find it
  • [X] I read the README.md file of the plugin
  • [X] I am using the latest version of the plugin
  • [X] All dependencies are up to date with flutter pub upgrade
  • [X] I did a flutter clean
  • [X] I tried running the example project

RafaelFurlan20 avatar Mar 04 '24 15:03 RafaelFurlan20