Change orientation of ios keyboard?
Asked Answered
M

2

9

Im using phonegap.build and i need to do the following on my game app:

The game is forced to landscaped mode at all time, and it has no canvas version of it, this is ios and android only game, and i use it with phonegap.

With the facebook-connect plugin:

https://github.com/Wizcorp/phonegap-facebook-plugin

I have a dialog, which i open with facebook-connect api:

facebookConnectPlugin.showDialog(Object options, Function success, Function failure)

in the options i have:

{
    method: "apprequests",
    message: "Come on man, check out my application."
}

which results in this:

enter image description here

I have a problem with that window, it opens in portrait mode, and i have an landscape only app ( it means the user, when prompt to this screen, should change the orientation, which is a bad behaviour )

I searched for hours for a solution for this and no luck.

Now, if i'm letting it stay like this, and i press on the 'search more friends' input, the keyboard opens on landscape mode, which results in this awkward behavior:

enter image description here

My question are those:

1) Is there any way to fix the popup of facebook to be landscape?

2) If no to 1, is it possible to control the keyboard as to how it opens (landscape or portrait), with any configuration in the config.xml (this is phonegap build) or any plugin that do such a thing

3) If no to all, what are my options to invite friends to my app (invitable is not an option, this is no canvas app)

Thank you

Misfire answered 7/6, 2015 at 15:46 Comment(6)
Hmm than can be a complicated issue to manage. What is the value of <preference name="Orientation" value="" /> in your config.xml ? Also, does it behave the same way with orientation locked and unlocked (iOS setting) ?Lipoid
This is not Facebook developers who are responsible of that since it has been fixed there : developers.facebook.com/docs/ios/change-log-3.x (3.18 : Fixed the orientation of web dialogs when linking against the iOS 8 SDK).Lipoid
Did you try both on your phone and your emulator ?Lipoid
Just to answer your question, just having the <preference name="Orientation" value="landscape" /> is enough to make FB SDK adapt to the app orientation. On Android it does work perfectly.Lipoid
Help! anyone? something? anything? those preferences not working at allMisfire
open an issue on the plugins git page or try another oneGoddord
Z
1

@totothegreat, On #1 I don't know. On #2, this is possible on Andrdoid. I don't know iOS. on #3, I don't know much about facebook stuff.

For Android, you need to set the orientation to landscape, and you need to tell Android you will handle the orientation and you will handle the redraw (which you will never need to do). This means you have control of the keyboard as well. In this thread, Ben Jones creates a slightly different solution.

Below are the two XML attibutes (android:configChanges & android:screenOrientation) you need to add to the <activity> element of the AndroidManifest.xml, BUT you can exchange both attributes for their equivalents in config.xml

     <activity android:name="basicScreenSize" android:label="@string/app_name"
                    android:theme="@android:style/Theme.Black.NoTitleBar"
                    android:configChanges="orientation|keyboardHidden|keyboard|locale"
                    android:screenOrientation="landscape">

The documentation you are looking for is buried in the <activity> section of the documentation. Again, the attributes you want are android:configChanges and android:screenOrientation.

Lastly, if you want to implement this with config.xml, then I suggest you read the thread with Ben Jones' implementation. Best of luck, text me back, if you are still having problems.

Ziwot answered 13/6, 2015 at 3:24 Comment(2)
Im sorry but the question was only for ios... so your answer is just not relevant....Misfire
FYI: If this helps. There is currently no way to ask for a splashscreen with iOS that is in landscape mode. I don't know iOS that well, but I can image there is a solution, but it must come from the native side of iOS. You can read my NOTES on this. BUGS -> DATE: 2015-06-07 BTW, you likely want to modify your original post to say it is for iOS only. The post implies you need both answers. Best of LuckZiwot
Z
0

@totothegreat, on this subject - part of the reason I am helping is because I will need to solve this problem myself. Here is what I have. To make this change on iOS you'll need to write an Info.plist (or equivalent) - which is an XML file. This Info.plist is equivalent to AndroidManifest.xml and config.xml

Google: apple ios Info.plist keyboard landscape

So far I have:

  1. About Information Property List Files
  2. UIInterfaceOrientation
  3. UISupportedInterfaceOrientations

Accordingly, you can integrate these attributes in Phonegap's config.xml. One phonegap, start with

Config File Elements

The instructions to write those attribute additions into config.xml are here:

config-file Element

Please note, the documentation in Config File Element says that adding to the config.xml is similar in format to plug-ins, and the config-file Element example is from the plug-ins.

Let me know how it goes. I'll need to try this myself. Jesse

Ziwot answered 15/6, 2015 at 8:51 Comment(1)
@totothegreat, I have it working now, with standard Phonegap Build. Note, they just upgrade two (2) days ago. screenshot of layoutZiwot

© 2022 - 2024 — McMap. All rights reserved.