Controlling the keyboard from a html page - android

First of all let me explain my situation:
I am developing a 8 player game for a company, which is going to be placed in a Shopping mall, for customer's entertainment.
The Platform is a round table, where people can stand in a circle to play the game.
The problem is , we want to let the users to connect their own Android Devices to the Game Computer via USB or WiFi or Bluetooth , and use their Android Devices like a controller. But not exactly like a controller , We just need 2-3 keystrokes from them, for instance lets say we need (W-A-S) from them to control the game character.
But there is some apps already in the Android Store which makes the Android device as a Keyboard and Mouse to control the computer.
But not every person would like to install an app in their devices right? So is there any other way?
Thanks in Advance.
Game Development Using Unity3D

Maybe you can build html page with that keys and send these commands to the server via ajax whenever users click some of them (this is easy task). Also you can provide every visit to the page with different hash or id or something and send this value with every command sent to the server, so you can know where the commands come from...

Related

How to connect and send data between android devices java

First off - YES I KNOW that there are an incredible amount of "tutorials" on the internet as well as SO questions on the topic that this question is on as well. PLEASE understand.
I have an app, and am trying to add functionality to transfer data between two Android devices. The data is small, merely xy coordinates for a button-clicking game to make it multiplayer. I decided that Bluetooth is my best bet. HOWEVER, after spending about 3 hours reading the official docs, I am still stuck. All I need is to: 1. Connect to a chosen device 2. Send the data. Its mostly about "Bluetooth Servers" and stuff, but I need a quick connection, and the code to send the data. Everything I've seen requires a HUGE amount of code, and doesn't really solve my problem. If the amount of code is required, is there a library that can help me? NOTE: I have already seen these, this, and this. Generally, the code provided doesn't work, is too cluttered/unreadable, outdated, or not easily implementable in my app without a major re-config pain. I'm looking for a solution that is Up To Date and Working.
(I can also be convinced to use WiFi if thats a better path to go down :\ ).
I also need the code to be compatible between Android devices down to API 21.
Scenario:
User_1 opens game and clicks "Multiplayer Mode". Selects "Start as Host". Now a game is running, but not started.
User_2 opens game and clicks "Multiplayer Mode". Selects "Join Device" In the background, the app is connecting the devices together.
A default Android Dialog appears, and they select RANDOM_GAME_NAME device, and clicks "Join".
User_1 is informed of them joining the game.
Game starts. Both players have a "board" where they try to tap buttons. User_1 taps button_1. Game sends signal to User_2 device that button_1 has been tapped and is now untappable. And vice versa until all the buttons are tapped.
Only two players can play at a time.

Is it possible to run an android emulator, get image files of its state, and emulate mouse function with it from a headless linux server?

If what I ask in the 'Questions' section can't be done, then the rest of this post is moot. Look at that first so you don't waste your time reading the background I provided if it turns out to be impossible.
Questions
My server is an AWS m4.large running headless Ubuntu. As far as I am aware, it does not have a GPU, although I have RDP'd into it in the past in order to do something that needed a GUI. Before anything else, I have a few questions about whether certain things are possible:
It seems to be possible to run an android emulator on a headless linux server, but is it possible to run an app with graphics despite not having a GPU?
(If so) is it possible to get an image file out of what the emulator is currently showing?
(If so) is it possible to emulate mouse functions based on X/Y coordinates despite it being run headlessly?
Work Done So Far
I'm currently trying to create an API for a mobile game that doesn't have one. So far, I have a clunky prototype written in Python (running on my Windows PC) that does the following (When the code starts, the app is open to a scrollable list of users in a "guild"):
Grabs a screenshot of the android emulator running the game
Searches the image for certain predefined "template" images (player names in the list)
Clicks on its location if the template is seen (opens player's stat page)
Uses OCR to read information on the page
Returns to the list and repeats from Step 2
If no templates are found, the program scrolls down and then repeats from Step 2
If all data from the predefined users is collected, the program ends
Issues with my Prototype
Python code must be run manually when the emulator running (and at the right page in the app)
The PC can't be used while the code is running since it uses image parsing of screenshot and mouse functions
It's not practical as an "API"
Next Steps
If the things I mentioned in the 'Questions' section are possible, then the rest should just implementing the code from my prototype, and having it repeat on a schedule.
If anybody has ideas for accomplishing the same thing in an easier way, I'm absolutely open to suggestions.
Thanks for reading!

Modify firmware of noname android tablet: first steps

I want to develop a HTML5 app to control doors, lights and other things in my garage. The frontend of will get displayed on a 24/7 turned on screen, that really only displays the app (kiosk mode). So there will be really only the app, no browser controls like back and forth button or url bar, and also no notification bar or back and home buttons of the device. Just the app.
For this I considered 2 options:
Doing it with a raspberry PI & connect a touch screen to i
Doint it on a dead cheap noname Android Tablet
Since the 2nd option is much more elegant from the hardware point of view (everything I need is already built in) I decided to try this first and bought a 70 USD Prestigio Tablet.
But since I'm no android dev, I'm not sure how I can even modify the stock firmware that's currently installed on the device.
As far as I can see, the bootloader is unlocked and ready for flashing a modified firmware image.
And here comes the question:
How can I get the device's currently installed firmware image? Do I have to contact the manufacturer for this or can I extract it from the device directly?
If I get the firmware image, how will I be able to modify files in it?
Or do you think I got the wrong route?
You need to find sources of firmware for your specific device. I bet manufacturer would not provide them. For Nexus devices it is easier because there is AOSP (android open source project) which gives you an opportunity to build a firmware. You can also check specific forums like 4pda.
But there is another way - to make a KIOSK mode for your device example. I'm not sure how does that fit into requirements. Also You can make your app as Launcher app and live with that :)

How should I connect my Android Device to my laptop(for my app)?

I've seen a few people ask this in a couple of different ways, but the answer was always too complex or not detailed enough.
I want to take a survey of a lot of people at a robotics competition. I ask them questions, and mark the answers on my android-based device in check boxes, radio buttons, pull-down menus, etc. In fact, I will have multiple people working with me and asking people the same questions as me. I'll have one person at a laptop staying at his table. Whenever someone gets a few people to fill out the form, they need to put the data on the laptop. There lies the problem.
We won't have WiFi in this location. We probably will have Bluetooth, I'm not sure, but it seems like using a USB connection will be the easiest method(correct me if I'm wrong). I have a "Sync" button. When they press "Sync", the android device should send all of its new data to the laptop, and the laptop should send all of its new data(from the OTHER people surveying) to the android device. I'm using java on both devices. How do I do such communication?
That is what I want, but if I need to make it easier, I'd be willing to cripple the program to this:
You can only store one form at a time, and the "sync" button will simply send that 1 form from the android device to the laptop, and the laptop won't send any data back. That'd be fine because they really should send the file to the laptop after every form, and they don't really need the forms.
Edit: if Bluetooth is easier, please say why. My guess (if it is easier) is because each Android device might have a different port to connect to the laptop, but I think Bluetooth is harder because I'm not sure how to pair the device to the laptop.
What you should do:
Every phone used to survey should already be paired to your laptop. You should know how to do this.
Have your forms, etc, do your Android app without the communication part first, and be sure to store your forms locally correctly.
For transfer you just open BluetoothSockets on both PC and Android. Have a look at the BluetoothChat example. It's pretty simple. Remember that, since the Android starts the connection it should be Client, while the PC is a Server. Here is the Android documentation page.
For logical sync of both PC and smartphone, you should have some sort of protocol. For example at first they both say what form numbers they have (PC might have forms number 1-19, 21, 23) (Android might have form numbers 20-23). Then they will exchange exclusive information only.
Don't forget to vote up if it's useful information.

Communicating with the PC via USB connection in Android

I'm fairly new to android programming and need some information for a 4th year forensics course project. Basically I am trying to create a suite of tools for live analysis of an android phone. I know how to get the information I need on the phone, but I was wondering if there was a way to communicate that information back to the PC? I want to be able to run a program from a PC, which, when the phone is docked, will allow the user to access information about the phone (ie currently running services/processes, bluetooth/wifi connections, etc). I have a bunch of methods that will run on the phone and get all the information, but I want to be able to call those methods from the PC, execute on the phone, then have the information sent back to the PC to display to the user instead of just displaying it on the phone. This is to leave as small a footprint on the phone as possible. Thanks a lot.
The ADT eclipse plugin does some of what you are asking.
http://developer.android.com/intl/es/guide/developing/tools/ddms.html
If you can track down the source for it, you should be able to figure out how to do it.

Categories

Resources