Dart game Android app and Java server to keep sore - java

My question isn't necessarily on how to do this - rather I'd really like to know where to start. I've made a program in Java that keeps track of a dart game. I have a core DartGame class and classes for the different games that inherit it. From there it keeps track of players, who's turn it is, the current score, etc. It works great now what I want to do is make it into an Android app. I have a server program on my computer that would link the running apps. I don't want a global server that can be accessed anywhere because I don't want to spend the money on a VPN server, so the server program would just run on my PC. An example of a similar type of server would be like the one used for AndroMouse which allows you to control the cursor on a PC with an Android device.
What is the best way to make the connection from the device to the PC? I'm not sure if it uses a MAC address or the WIFI from my router, or even Bluetooth is an option. I'm not really familiar with Android but I assume there would be some sort of Server/ServerSocket connection, but that requires an IP address and I'm not sure which one to use. Is it as simple as using the local IP from my router? Like I said I'll learn how to do it on my own, I'd just like to know what I need to learn before I spend a bunch of money on Android books. Thanks in advance.

If your pc and your device are in the same LAN, just create socket to communicate through wifi connection. Otherwise, you should choose bluetooth I think. I think the
If they are not in the same LAN, then it is a little bit difficult. MAC address is meaningless unless in LAN.
AndroMouse also uses bluetooth connection.

Related

Using DSLR Controller for a Secondary Display

I am trying to create a low latency method to use an android device as a secondary display for a PC. So far all I have found has been either wireless streaming, or a slow usb connection (i.e. using iDisplay).
However, I found a DSLR camera contoller app (https://play.google.com/store/apps/details?id=com.dslr.dashboard/) that is able to stream a live feed of the camera to an android display via USB. Would it be possible to edit the source code of this application so it can read the video output of PC via USB? If so, how would you go about this? Do you think that this would be a low latency alternative?
Thank you!
Lots of fantasy in your question. Have you ever seen a PC outputting data from one of its USB ports to another device? How are you supposed to do that? With a plain male-to-male USB cable, in case you find one? Sorry but things don't go that way. To transfer data (files, or a network) via USB between two computers you'd need some propietary/specific software. Of course, once you have acomplished that is technically possible to transfer files with the screen content. Buy you'd need to develop a software that would capture the computer screen, compress it in real time, and send it through USB with enough low latency to be usable. That's going to be resource intensive.
A better, easier approach would be, maybe, using some sort of remote desktop or VNC on the Android machine, with the computer acting as a server. At least far more feasible than trying to implement a similar protocol by yourself.
Sorry but what you are trying to achieve is flawed from the beginning.

Speed of forwarding ADB ports to send data from Android device to PC

I am looking for a very fast method of sending commands from my Android device to my computer.
There are 3 methods in question, Bluetooth, ADB w/ USB, and USB. A server socket connection is too slow for what I need.
All 3 seem to give me a headache when trying to implement them.
I know a straight USB connection would be faster than anything else, but I'm finding it especially difficult to implement.
Many users suggested using adb to communicate over USB.
The main method in question is using the ADB server/client implementation, where I would forward the ADB ports and use a socket connection to host a server on my Android device (Somehow the USB is involved).
More information is available here:
http://www.anothem.net/archives/2010/02/15/communicating-over-the-usb-cable/
Would this method be any faster than using a standard server/client socket connection (since there is a USB involved in this method).
I'm a little hazy about how this all works, since I don't think it's a very common request. If anyone could explain this method a bit more I would greatly appreciate it.
Thanks!
I made an application which I started with Bluetooth, after some testing I decided to go with normal TCP sockets with the WIFI interface. The application consists of one PC which handles up to 20 tablets for a commercial command entry in restaurants, discos, etc. Every time a tablet connects the server send about 100 small JPG pictures which represent the different items in the menu. It's done very fast, less than a couple of minutes, and in normal data entry I've seen no problems so far.
I don't know how fast you need it to be but WIFI sockets are as least as fast as USB (2.0) and Bluetooth. Also with sockets the tablet and the PC can be hundreds of meters away from each other, depends on your WIFI configuration which can be expanded easily. Other thing to consider is when the device goes to sleep, when it wakes up it may take some seconds before getting the WIFI up and running and, in some few strange cases you need to restart the socket connection.
Whichever you decide to use, all of this should be handled by a well define protocol of course.

connect my local PC to ANDROID device using Wi-Fi

I am working on one android app. I want to connect my local PC to ANDROID device using Wi-Fi(Local).
just like this APP.
I am new to network programming.
Anyone help me to do this some architecture or example or code.
You could use the Server-Client architecture. Depending on what you want to do you could either set up a server in the phone and have a client on the computer that will connect to the phone. Or the other way around, server on the computer and let the phone connect to it.
Here is another thread that have some example code (there is a lot of other examples and tutorials):
Android - Server Socket
There's no way around this except by hard work. You are expected to read the documentation and work through the examples. There are heaps of tutorials on Programming on Android on the 'Net. Use them.

Controlling your phone from laptop

Idea: create a remote control for your android phone.
Why: I like listening music on my phone in a dock station with speakers connected. Now sometimes I want to turn the volume up/down, change the song, etc. So I need to unlock the phone, locate app that is playing music (Music player, internet radio app, etc.). Sometimes I manage to undock the phone or just mess something up and generally this s*cks.
So I would like to control my phone (on a data connection, not wifi) from the laptop (on wifi).
I had investigated couple of approaches and would like to get some recommendations on them:
Use XMPP. This is nice as there a lots of free XMPP services I can use. Two libraries (both based on smack) that I tried work just fine (Flow aSmack port and Beem smack port). I could automatically create new user on device and present some id/password combination that I (user) would enter on a desktop side to link both devices.
Use JXTA. Should be the next real deal but could be an overkill. I would imagine running a rendezvous&relay server somewhere (need to get hosting to work around firewall/NAT) and creating a peer group protected with password. Use device unique id and password (withing group) to link to the desktop application. (A great eBook explaining p2p and JXTA can be downloaded from here).
Use C2DM. Could be the answer, but notification delivery sometimes can take more then couple of seconds to deliver and there would be no feedback mechanism.
So far first solutions looks like a lot easier choice. Create custom extension or just create chat between both endpoints and use that for relaying commands/messages. But I wonder if I would be abusing XMPP system?
JXTA sounds great, but from all the reading I done it is apparent that it is designed for group communication and service sharing and not a solution for connecting two endpoints.
What do you guys think? I welcome all suggestions too.
UPDATE I do not want to remote to a phone and interactively control it. I want to establish a connection (socket connection) between laptop and phone even if both of them are on different networks secured behind firewalls, routers. With this I could define a protocol to issue commands to the phone (lower volume, mute, start app, etc.).
UPDATE 2 I'm giving JXTA a shot. It is a nice solution but lack of documentation is a bit of a downer. Got VPS FreeBSD server to test RDV/relay side of things. I keep updating this question further as it may be helpful for others.
UPDATE 3 Some more reading:
How to make two android devices to communicate through TCP
Connection between two computers without opening ports using a third computer
UPDATE 4
So far I did not have enough time to further continue my project. I did find an interesting project. At the moment project owners are re-writing their library, you can track their progress here.
why do not you try installing VNC server on machine and then use VNC client on laptop to access mobile
Mobile Shell (Mosh) maybe just the tool you are looking for. I have been looking for a good project to use Mosh, your idea seems pretty interesting :)

Control a desktop application using an android phone

I want to build an application where an android phone would control a desktop application.
I only need to send coordinates from the phone to the desktop when user's finger is on the phone screen.
But I am kinda confused on the networking side if i should use bluetooth, usb, or wifi (intranet).
I did some research on bluetooth, doing bluetooth socket programming on an android phone shouldn't be a problem, but on the desktop side there are only a few free SDK/library. any suggestion on what to use?
If I were to use USB/cable, What API on the android side I need to use?
I am actually more familiar with general socket programming (wifi), but I think it's going to be slow (correct me if Im wrong) so this would be my last option.
PS: I am using Java for the desktop application too
any suggestions on what method to use? or even maybe I should use .net on the desktop side?
Thanks
You might find the open source RemoteDroid app to be useful in creating your app. It may even do everything that you want.
The source code is here. You may need an svn client like TortoiseSVN in order to download it.
Wifi is probably the most supportable.
Bluetooth requires hardware and drivers on the PC side
USB would ordinarily seem like the most sensible if the wire isn't a problem, but the catch is that it requires that the user enable "USB debugging" on the phone, and have either the android SDK or equivalent functionality to the adb forward command installed, plus a compatible USB driver for the phone. If all that were the case, you'd just forward a port from the PC to the phone and have a pc program connect to that port on the loopback interface which will be forwarded to a service running on the phone.
It's possible you could do something piggybacked on the USB tethering capability of more recent releases to get you a network-over-usb that you could use to connect programs on the PC and phone, but you'd need modified PC drivers so that you don't actually push the PC's internet traffic through the phone (unless you mean to tether as well).

Categories

Resources