Change orientation of ios keyboard?

603 Views Asked by At

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

2

There are 2 best solutions below

1
On

@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

2
On

@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.