mrcendre / motion

A Flutter plugin to apply a gyroscope-based motion effect to widgets.
GNU General Public License v3.0
39 stars 15 forks source link

Broken example on Android #3

Closed sebastianbuechler closed 2 years ago

sebastianbuechler commented 2 years ago

The current main a has a broken example because of some recent changes (the new Motion.elevated constructor and undefined hitTestBehavior parameter in MouseRegion).

However, when fixing them I also get a general error while running with Flutter 2.10.5:

This app is using a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to migrate this app to the V2 embedding.
Take a look at the docs for migrating an app: https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects  

And additionally:

The detected reason was:

  No `...\motion\example\android\AndroidManifest.xml` file

Is it possible that the example was only tested for iOS?

mrcendre commented 2 years ago

Thanks for the PR @sebastianbuechler !

You are right, the plugin has not been thoroughly tested on Android. It is my understanding that the gyroscope's events sample rate is much lower on Android, which makes it hard to achieve a smooth effect. I'm currently investigating the option to add interstitial events to trigger more frames using linear interpolation.

As for the example app, at the moment, contributors and plugin users are responsible for properly enabling their platform of choice. "Flutter embedding" warnings are really not something to worry about in sample apps, as long as the app that depends on the plugin uses the latest version of Flutter embedding.

sebastianbuechler commented 2 years ago

@mrcendre That was exactly the reason why I wanted to test the example of your package. I used the plugin on our project and did not get a smooth experience on Android. In fact, it even lagged for multiple seconds after a bit. Not sure if this helps, but another package for sensor access provides updates on android in 60 fps: https://github.com/zesage/motion_sensors/commit/c14e6a60f0543d2be9ec4a923ae0f75b1097244d

For the example app, it was not just a warning but an error. So I could not run it on my system for reproduction.

mrcendre commented 2 years ago

Not sure if this helps, but another package for sensor access provides updates on android in 60 fps: https://github.com/zesage/motion_sensors/commit/c14e6a60f0543d2be9ec4a923ae0f75b1097244d

@sebastianbuechler I will definitely check it out, thanks !

For the example app, it was not just a warning but an error. So I could not run it on my system for reproduction.

Unfortunately, at the time, no platform is enabled by default for the example app. In other words, users are responsible for properly setting up the example app for their platforms (the AndroidManifest.xml on Android, etc.).

A shorthand for creating the Android project : cd example then flutter create --platforms=android ..

sebastianbuechler commented 2 years ago

Not sure if this helps, but another package for sensor access provides updates on android in 60 fps: https://github.com/zesage/motion_sensors/commit/c14e6a60f0543d2be9ec4a923ae0f75b1097244d

@sebastianbuechler I will definitely check it out, thanks !

For the example app, it was not just a warning but an error. So I could not run it on my system for reproduction.

Unfortunately, at the time, no platform is enabled by default for the example app. In other words, users are responsible for properly setting up the example app for their platforms (the AndroidManifest.xml on Android, etc.).

A shorthand for creating the Android project : cd example then flutter create --platforms=android ..

Thanks for the information. Nice package you built, hope that we can use it even on android in the future!