Jump to content

Phaser, Cordova and text input on Android


mazoku
 Share

Recommended Posts

https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-dialogs/

navigator.notification.prompt

function onPrompt(results) {
    alert("You selected button number " + results.buttonIndex + " and entered " + results.input1);
}

navigator.notification.prompt(
    'Please enter your name',  // message
    onPrompt,                  // callback to invoke
    'Registration',            // title
    ['Ok','Exit'],             // buttonLabels
    'Jane Doe'                 // defaultText
);

 

Link to comment
Share on other sites

Native dialog sounds fine, although not sure it can accept user input beyond button clicks (maybe it can, example above doesn't show that).

What's wrong with a DOM input field? Pretty sure there are a couple of Phaser Input modules kicking around that fake this in a more Phaser-idiomatic way as well if you wanted to stay within the Canvas and keyboard event listener realm.

Link to comment
Share on other sites

1 hour ago, mattstyles said:

Native dialog sounds fine, although not sure it can accept user input beyond button clicks (maybe it can, example above doesn't show that).

What's wrong with a DOM input field? Pretty sure there are a couple of Phaser Input modules kicking around that fake this in a more Phaser-idiomatic way as well if you wanted to stay within the Canvas and keyboard event listener realm.

Yes, it can accept text input. You can also use the native keyboard plugin. Of course, there are multiple ways to do this but that's the Cordova way.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...