Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyboard issue #6

Closed
DanielTortosa opened this issue Jan 22, 2013 · 23 comments
Closed

Keyboard issue #6

DanielTortosa opened this issue Jan 22, 2013 · 23 comments

Comments

@DanielTortosa
Copy link

I started the sample project (with Google url) and i couldnt write letters in the google textbox).

Unity 3.5.7
Tested on HTC Desire and Nexus 7 (both with Android 4.2.1).

@dillrye
Copy link

dillrye commented Feb 18, 2013

I am having the same problem on Unity 4.0 with this plugin. I get different results with different phones. On a galixy s3 i can not type anything at all, and on a galixy nexus i can type only letters(not numbers or backspace)
I get the following information in logcat:

02-18 13:10:43.606: V/webview(11193): singleCursorHandlerTouchEvent -getEditableSupport FASLE
02-18 13:10:43.906: D/webview(11193): blockWebkitViewMessage= false
02-18 13:10:43.916: D/webcoreglue(11193): WebViewCore::nextTextOrSelectNode : nextNode is NULL
02-18 13:10:43.916: D/webcoreglue(11193): WebViewCore::previousTextOrSelectNode : Broken after finding a focusable Node
02-18 13:10:43.916: D/webcoreglue(11193): WebViewCore::previousTextOrSelectNode : Final Previous Nodename = , tagname =
02-18 13:10:43.916: D/webcoreglue(11193): WebViewCore::nextTextOrSelectNode : nextNode is NULL
02-18 13:10:43.916: D/webcoreglue(11193): WebViewCore::previousTextOrSelectNode : Broken after finding a focusable Node
02-18 13:10:43.916: D/webcoreglue(11193): WebViewCore::previousTextOrSelectNode : Final Previous Nodename = , tagname =
02-18 13:10:43.916: D/webcoreglue(11193): WebViewCore::nextTextOrSelectNode : nextNode is NULL
02-18 13:10:43.916: D/webcoreglue(11193): WebViewCore::previousTextOrSelectNode : Broken after finding a focusable Node
02-18 13:10:43.916: D/webcoreglue(11193): WebViewCore::previousTextOrSelectNode : Final Previous Nodename = , tagname =
02-18 13:10:43.916: D/webcoreglue(11193): WebViewCore::nextTextOrSelectNode : nextNode is NULL
02-18 13:10:43.916: D/webcoreglue(11193): WebViewCore::previousTextOrSelectNode : Broken after finding a focusable Node
02-18 13:10:43.916: D/webcoreglue(11193): WebViewCore::previousTextOrSelectNode : Final Previous Nodename = , tagname =
02-18 13:10:44.036: W/IInputConnectionWrapper(11193): getCursorCapsMode on inactive InputConnection
02-18 13:10:44.107: W/IInputConnectionWrapper(11193): getCursorCapsMode on inactive InputConnection

@barrynorthern
Copy link

I have exactly the same problem. Has anyone resolved this yet?

@dillrye
Copy link

dillrye commented Mar 5, 2013

We were able to get around the problems on android by creating a new activity for the web view to live in instead of just instantiating the webview in the unity activity. As far as I can tell,it looks like the unity activity is swallowing the key presses. This is not ideal, as it requires you to manually edit some of the files after exporting the project as an eclipse project.

@barrynorthern
Copy link

Thank you! I was just about to embark on this idea -> I'm glad you've confirmed it worked for you. Did you need to save any cookies? If so, were there any problems passing cookies between activities? I would be really grateful if you were able to share any other nitty-gritty details: they would be most useful. :)

@barrynorthern
Copy link

I'll let you know if I find a way to automate the build process: I need to be able to come up with a solution that works within our continuous integration system.

@barrynorthern
Copy link

I've successfully created a webview that can store cookies, runs in another activity, and continue to authenticate http requests after the unity activity resumes, without bringing up lock screens between activity switches and all completely automated from Unity -> APK.

The trick to making the build an automated process is to make amendments to the standard AndroidManifest.xml and save it under Assets/Plugins/Android/

In this folder you must also include your .jar file for the WebView plugin, which needs to include the new webview activity's class.

To keep cookies, make the cookie manager class and cookie manager sync class persist in a singleton, created from the main plugin code. I also kept the reference to the webview in there, although this was created with the new activity's context. Subsequent post and get requests were implemented with HttpClient using the auth cookie taken from the cookie manager. Lock was prevented by adding this override to the new activity:

@Override
public void onAttachedToWindow()
{
    Window window = getWindow();

    window.addFlags(
            WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON +
            WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED +
            WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON +
            WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD );
}

and adding this to the onCreate

    PowerManager pM = (PowerManager)getSystemService(Context.POWER_SERVICE);
    wl = pM.newWakeLock(PowerManager.FULL_WAKE_LOCK, "wakeLock");
    wl.acquire();

Be sure to wl.release (wl is a class variable) in onPause(), or perhaps pass the reference back to the Unity activity to release once it has resumed.

The webview will show with status bars and titles etc. unless you add the following to onCreate() as well ...

    requestWindowFeature(Window.FEATURE_NO_TITLE);this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

@endavid
Copy link

endavid commented Jun 11, 2013

You just need to enable ForwardNativeEventsToDalvik in you Android Manifest,

http://docs.unity3d.com/Documentation/Manual/PluginsForAndroid.html

@PetrBodnar
Copy link

I tried to fill login fields on this URL: http://minecraft.net/login
Android version is 4.0.4
The keyboard didnt work.
I test this in sample project from last commit.
I check that I have ForwardNativeEventsToDalvik in Manifest

barrynorthern, can you provide please more detailed description of your workaround for keyboard input?

@alexgalkin
Copy link

Issue is still in place. Please let me know if someone has found the solution.

@barrynorthern
Copy link

The only way I got the keyboard to work properly on Android using the gree
webview was to create an activity to host it.

On Mon, Oct 28, 2013 at 4:16 PM, alexgalkin notifications@github.comwrote:

Issue is still in place. Please let me know if someone has found the
solution.


Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-27226576
.

Follow me @barrynorthern http://twitter.com/BarryNorthern

@alexgalkin
Copy link

@barrynorthern, can you please provide some working example?

@alexgalkin
Copy link

@DanielTortosa @PetrBodnar @dillrye @endavid , Have you found any solid solution for that problem? Can you please share working example?

@barrynorthern
Copy link

Please refer to the android sdk documentation on how to start a new
activity:

http://developer.android.com/training/basics/firstapp/starting-activity.html

The activity manifest xml snippet should be added to
Assets/Plugins/Android/AndroidManifest.xml

Create an activity which simply starts the gree webview plugin, and the
keyboard should work fine.

I am unable to share specific code, as it is tightly coupled to proprietary
code under NDA.

On Tue, Oct 29, 2013 at 5:37 PM, alexgalkin notifications@github.comwrote:

@DanielTortosa https://github.com/DanielTortosa @PetrBodnarhttps://github.com/PetrBodnar
@dillrye https://github.com/dillrye @endavidhttps://github.com/endavid, Have you found any solid solution for that problem? Can you please share
working example?


Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-27325286
.

Follow me @barrynorthern http://twitter.com/BarryNorthern

@alexgalkin
Copy link

@barrynorthern just to be clear - should we create Activity within WebViewPlugin codebase and export updated library or should be create new Activity at C# code within Unity script? Please confirm.

@lowolf
Copy link

lowolf commented Aug 23, 2014

Does anybody fix this throwable without new Activity?

@lowolf
Copy link

lowolf commented Aug 23, 2014

Need quick fix, because today publish day, but WebView didn't work correct =(

@lowolf
Copy link

lowolf commented Aug 23, 2014

Guys!?

@barrynorthern
Copy link

You need to create a new activity in Unity's android manifest file to host
the gree Web view plug in, which I'm gave references on how to do in a
previous reply. It was a long time ago and haven't used it since sorry
cannot remember details.
On 23 Aug 2014 18:20, "lowolf" notifications@github.com wrote:

Guys!?


Reply to this email directly or view it on GitHub
https://github.com/gree/unity-webview/issues/6#issuecomment-53159315.

@lowolf
Copy link

lowolf commented Aug 23, 2014

Sorry, but i don't understand what i need do...

@barrynorthern
Copy link

You haven't explained the exact nature of the problem yet. I'd be happy to
try to help you if you can be as specific as possible please.
On 23 Aug 2014 19:12, "lowolf" notifications@github.com wrote:

Sorry, but i don't understand what i need do...


Reply to this email directly or view it on GitHub
https://github.com/gree/unity-webview/issues/6#issuecomment-53160844.

@lowolf
Copy link

lowolf commented Aug 23, 2014

When webview open, i see input field, when field focused, keyboard showed, but nothing typing. That's all. This is damned trouble

@barrynorthern
Copy link

android apps are made from one or more subprograms called Activities. Unity
runs in an activity, and the way it is connected to the device keyboard
when you open the webview from Unity is preventing the input reaching the
WebView. If you create a new Activity for the Web View to run in, the input
works because the Unity Activity is put to sleep while the new Activity
effectively takes over everything, including the keyboard input. You can
launch a new activity from Unity using its android java api. Then, whenever
you've finished in the webview activity you can go back to the Unity
Activity from there.
On 23 Aug 2014 19:18, "lowolf" notifications@github.com wrote:

When webview open, i see input field, when field focused, keyboard showed,
but nothing typing. That's all. This is damned trouble


Reply to this email directly or view it on GitHub
https://github.com/gree/unity-webview/issues/6#issuecomment-53161009.

@KojiNakamaru
Copy link
Member

A while back there was the issue discussed here and it was caused by NativeActivity. Recent Unity and unity-webview combination don't have the issue. Please reopen the issue if you have any assistance further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants