trigger.io programmatically set orientation

2019-07-11 04:35发布

Is there a way to programmatically set orientation? The issue I am having is a horrid looking launchimage while the app is loading in landscape orientation. This is true for both iOS and Android. My launch image has a white background and when holding (or simulating) the device in landscape one can see the black background filler.

Maybe I can restrict the orientation to portrait in the config... and then after launch is complete... then allow (programmatically set) for both landscape and portrait? Or maybe allow me to set the launchimage filler color to something other than black (which looks fine using the default trigger.io launchimage because it has a black background)? My current settings are:

    "launchimage": {
    "iphone": "img/320x480.png",
    "iphone-retina": "img/640x960.png",
    "ipad": "img/768x1004.png",
    "ipad-landscape": "img/1024x748.png",
    "android": "img/640x960.png",
    "android-landscape": "img/1024x748.png"
    },

The launch image (while holding the device in landscape) looks similar to this image

enter image description here

标签: trigger.io
3条回答
劳资没心,怎么记你
2楼-- · 2019-07-11 05:09

It appears than forcing landscape as only available orientation in App config conflicts with display.orientation.forceLandscape() statement, resulting in a portrait app (even if the success callback is triggered)

[DEBUG] Native call "display.orientation_forceLandscape" with task.params: {}

[DEBUG] Returning event: {"event":"internal.orientationChange","params":{"orientation":"portrait"}}

If I omit "display.orientation.forceLandscape()", all is working fine.

Hope this helps

查看更多
倾城 Initia
3楼-- · 2019-07-11 05:12

There's currently no Forge API to programmatically set orientation, but we've been asked about it before and have a ticket in our backlog, which we've bumped up.

I'll report back here when the API is available.

Update: this is now available in our v1.4.13 platform version: http://docs.trigger.io/en/v1.4/release-notes.html#v1-4-13

查看更多
时光不老,我们不散
4楼-- · 2019-07-11 05:16

The reason for this seems to be the down-scaling of images due to the devices pixel ratio / pixel density.

Example: The Samsung Galaxy Nexus has a pixel ratio of 2 (Source). If you want to have a full width launch image in landscape mode (1280 x 720 px), you'd need an image with at least 2560 pixel in width.

By the way: as of platform version v1.4.21 you can change the background color of Android launch images in the config.

查看更多
登录 后发表回答