Android AR Sceneform device orientation change - android

I'm working on an app that has a Single Activity and a fullscreen Fragment in that activity that uses AR Core and inherits from Sceneform. What is a good strategy for handling orientation with AR elements? It seems that most Google produced applications that user AR (Camera Playground, Maps, Arts and Culture) lock the view to portrait when in an AR session. However, we want users to be able to interact with the view when tilted to landscape as well. That would be fine to still have it locked to portrait and the user could just tilt their phone except for the issue with Android 10 gesture navigations. If a user orients their phone in landscape (while the activity is locked to portrait), a swipe from the top of the screen (which would appear to bring up the status bar) would send an onBackPressed() which would be a big UX issue.
Have others faced this issue before? Is it possible to programmatically remove the gesture navigations? Or move them without a full config change?

Related

How to lock the orientation of the content of activity or surface in Camera app without locking the system orientation change?

I'm trying to implement orientation change in an app with a camera.
Currently most of the Camera apps do not support device orientation. Most of them lock screen orientation in portrait mode and rotate some UI elements inside by implementing OrientationListener. But with this approach, there are problems with the system behavior: keyboard and navigation gestures remain in portrait mode, which confuses users.
However, I see completely different behavior in the latest version of the default Camera app on Samsung devices. Device orientation is no longer blocked. But the camera surface does not show any signs of orientation change.
In every camera implementation I've tried, even at best you can see some flickering on orientation changes.
My guess is that for the Samsung camera app they managed to lock the orientation of the activity content or surface without locking the system orientation change.
My question is how to achieve this behaviour?

Can you replicate Android Stock Camera rotation in flutter?

I've tried to replicate android's stock camera rotation in flutter but to no success. Either the whole app rotates, or nothing rotates. I tried to also dig deeper into the native code, but couldn't find anything that keeps the app static, while the whole system rotates behind the scenes. The main thing I am looking for is to keep the Camera view static (landscape mode), and rotate the UI with the system depending on the device orientation.

Change screen orientation in a Unity Google Cardboard project

I'm just starting a cardboard project as it's really joyful to experiment VR without any huge hardware, but I have a little problem which sounds really basic : the screen orientation. I just would have my game playable in Landscape Right instead of Left as I'm developing on my Xperia Z.
Usually screen orientation's problems are solved by forcing the orientation through the Player's Settings in the Build Menu. But here, the fact is that when I tick the "Landscape Right" box instead of the left one (which is the default setting of the Cardboard API) it correctly inverts my display but my camera stays at the same orientation as before.
From this results that my gyroscope works in reverse and that the ground is seen on the top, with all the texts reversed as well.
I've already done what Eldir tried here (Google cardboard device orientation) but as it wasn't the same problem I'm having, it wasn't efficient.
Do you have any ideas that if the API allows a quick change for this, or if I have to modify the whole parameters of the gyroscope ?
Thanks !

How does the Android Lock Screen Camera work

In Android 4.2 new lock screen widget have been introduced. They can be accessed by sliding left or right on the lock screen.
One of those widgets is a camera widget — only this camera widget is behaving differently from any other widget – lock screen or otherwise.
Once you slide to it the widget zoom to full screen and from that onwards behalves like an App. The lock screen camera has rich controls which would be close to impossible to implement using the confines of android.widget.RemoteViews.
Here my two questions:
How does this actually work?
Can it be replicated by normal applications (or is it a feature only available to system applications)?

Android Difficult Screen Orientation

I have recently started studying Android, and I would, as first application, create my own camera. After taking a look at the API and other examples on the internet, I was able to create a working app, however I have this problem: if I rotate the tablet that I'm using to try what I do, my app rotates in the wrong way.
So, when I switch from portrait to landscape, the transition is successful and buttons rotate correctly, but what camera really sees is as if it were rotated 90 degrees more than it should.
All this unless I decide to set in my activity screenOrientation: landscape, because in this case the camera sees everything correctly, but the buttons remain fixed in one place, don't rotate with the rotation of the tablet.
I have a tablet with only front-facing camera.
What can I do to fix the problem?
check this answer I gave some time ago, it does have a nice method to call to correctly set the camera orientation.
How can I know the position of the camera on an android device?
and with that code you should let your activity rotate freely

Categories

Resources