How to connect and send data between android devices java - android

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.

Related

Android app glitch reviews when much better on Apple in Codenameone app

Please could i have some advice from those who have been building apps for longer than myself. After 18 months of developing 2 quite complex CN1 apps, available on IOS and Android stores, I get starkly different customer feedback.
On both stores i get similar download levels (<10 a day).
From Google Play i receive nearly zero revenue and 1 and 2 star reviews, citing that the app of full of glitches, 'does not work' and freezes - but the same time reviews say they really like the app if it worked. I do not receive any examples of information to guide me on where to fix. It runs fine in my simulator (even slow network mode) and on my own Android device. Hence i'm not sure the best way forward, which is the advice i am after.
On IOS i receive mixed reviews, generally 2-4 stars but i get some revenue.
FYI, the app uses Rest web services to send data to/from my cloud database, so network is likely a cause, although i cannot reproduce. I can imagine customers clicking a button many times on the trot if the network is slow resulting in the transaction or screen showing multiple times. But just a guess. The cloud server is running fine with no spike in CPU or memory. I have tried to keep physical JSON network traffic loads small so that should be fine.
Would you agree that the next steps are to:
Verify the network traffic numbers, using the network monitor in the simulator and get these down if poss.
Check that buttons disable themselves when pressed to avoid double tap.
Write to a local storage log of timings when a user moves between screens, and pass that to my database on app exit, for my analysis on slow navigation.
Are there any other tips and tricks please?
Thanks in advance.
I would suggest using something like the rating widget to track user satisfaction. When a user provides a low rating ask him to email you personally so you can discuss the problems.
I would also suggest crash protection. Most of these cases occur due to on device exceptions that are hard to pinpoint and generally happen more on Android. Crash protection will send out emails with such details. Also check out the ANR/Crashes in Google Play's developer console to see if there's something you can improve.
Also you can add the play store link, I'll take a look and see if something pops out for me.

How do I open an app Based on an external Event

Use case: I have security cameras around my home (on zoneminder). When an event is triggered (someone walks by the camera) I want to have some screen nearby the door and ideally push a notification to devices (hopefully android tablets) to display the camera view on all these connected devices.
I'm happy developing my own app if necessary (even better if such an app already exists). But does Android support this functionality to allow an app to open based on an external event (some message to the app)? I've personally never seen it (phonecall is the one exception). I'm sure listening for events is easy, but I can see there being a rule not to allow apps to 'force open' in this way.
If there is a way, if you could point me to the class that would support this I would appreciate it. Thanks!
(If you have any other solutions for my use case, I'd be happy to hear them. Unfortunately, I'd like these tablets to run other apps too, so keeping the 'camera app' open constantly isn't really a solution for me.)

Android Video Pushed To Internet TV

I've got an application with Exoplayer. Works perfectly.
A request came to implement the "Cast to TV" (like the Apple TV Icon you get at the bottom when an Apple TV is present in the same network)
I've been trying to read up on this for Android, though seem to get lost be different information by different contradictions.
Some talk about a sender and receiver app, but i'm pretty sure this would not be needed as I have seen other apps where i can just push to the tv without having to install other software on the tv or whatever. (I understand that these TV's must comply to some certain standard)
Surely there is a way to:
Put a cast button at the top
Press it and show a selection screen of devices available
Then tell the player to "cast to tv"
(simply said of course)
Does anyone know of clear information and/or sample?
Please don't link to the Android pages, because that's one of the reasons I got lost in this matter.
https://developer.android.com/guide/topics/media/mediarouter.html
has no mention of needing another app.
What is allShare? Only for samsung or is there a universal standard?
Thank you to the person who will take the time to explain and provide some insight to where to start.

Controlling the keyboard from a html page

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

Bluetooth concurrent connections

For a fest at my college, we are planning a quiz contest.
For the buzzer round, I was thinking of writing 2 app for android (we have a few handsets), one for the quiz master and the other for the contestants
The contestants will be connected to the quiz master through bluetooth.
After reading the question, the quiz-master clicks a button in his/her app, the button in the contestant apps will be enabled for X seconds. As soon as a contestant clicks his/her button, the quiz master's app will flash the name of that contestant.
My questions:
Is it even possible to have multiple connections and accept concurrent (or multiplexed) messages from them in bluetooth (something similar to select() in unix/c)?
If possible, where should I look for any examples? What kind of problems will I face trying to develop this (I know reliability is an issue here) and how to avoid them?
I had tried this on laptops before and failed. But maybe I gave-up very early. Please help.
EDIT:
I gave-up the project (too many connection drops). I'm keeping the question open though.
Bluetooth supports piconets, in which a single (quiz) master can communicate with up to 7 slaves.
So, at the Bluetooth level, this should be doable. I'm not the person to say if it's possible to implement using Android's Bluetooth API:s, though.
Have you read though this and the rest of the information available specifically for Android?
http://developer.android.com/guide/topics/wireless/bluetooth.html
Aside: When I was in college we did trivia nights the old fashioned way (paper and pencil) but on the plus side you didn't have to worry about having expensive phone handsets in the hands of drunken college students! ;-)

Categories

Resources