Google Play Services notification choose orientation

Hello, after few days of watching tutorials on how to implement Google Play Services in my game I finally manage to make it work, at least the first step.

Sign in and test an achievement I made.

And because this is my first game I found my self on a "problem" more or less.
The game is oriented in Landscape Right but the game when you play it is on vertical like portrait.
In short my game that is played vertical was developed in Landscape Right mode, the camera, all canvases, configs is for that.

So when I play my game the achievements it shows on left side (because of Landscape Right) default orientation, but I need to show the UI only on portrait if possible.

I can't modify the game now to portrait because will break a lot of things.
I asked chatGPT and suggest me:

android:name=".MainActivity"
android:screenOrientation="sensorPortrait">

and

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

But I don't understand it very well, or where do I need to modify and add this new lines.

So the game remains on landscape right but notifications show them in portrait.

Any suggestions ?

Make sure you have your orientation set in Project Settings > Player
8877843--1212732--upload_2023-3-15_11-10-36.png

I already have it like that, the problem is that the game when you play it is viewed on vertical portrait, so the notifications UI from google play services comes from left side, while you playing on vertical.
I need to show GPS UI in vertical portrait mode (Green Box), while the game remains in landscape right.

I'm slightly confused, are you saying that the game is already landscape, but is showing portrait and you're wondering why the notifications are coming out landscape?

If so, then that's the answer, run the entire game either in Portrait or Landscape.

That’s the point, the game is already setted in landscape mode but when you play the game was designed as Vertical to play, the problem is notifications and UI of google play services shows as landscape too.

That’s what I’m trying to figure out to show only UI in portrait mode while game remains in landscape to show correctly the game.

(other solution much more tedious will be to refactor the game a lot, to be in portrait from beginning but there is to much to change, scenes, a lot of canvases and specific orientation. )

Here is an example of UI GPS.
c85d96

Unfortunately there’s no possible solution to what you are trying to do.

The way you have your orientation set out to be set in landscape, but plays in portrait mode is a little unconventional, I’d try to shift to either landscape or portrait, that way, the devices system UI will follow the orientation of the game.

Thanks for the answer,
I looked on google with multiple pages and tutorials, nothing, also I asked chatGPT and suggested me to use this code on AndroidManifest:

<activity android:name="com.google.games.bridge.NativeBridgeActivity"
          android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
          android:screenOrientation="portrait" />

But for me didn’t work, I post it here maybe, will work for other people.

In the end I had to change my game to Portrait and with help from a friend , helped to solve de orientation canvases that messed up everything and also the controls of the players.

Thanks for helping!

1 Like

It’s interesting to see people use ChatGPT however, please remember it only has information for what has been and what was, I’d advise writing the code first and then seeing if ChatGPT can help further optimise it.

Glad to hear you now have it working though.

1 Like