I have a requirement where, I need to establish communication between a program running in Linux machine and android app running on phone. Both phone and PC are connected to same wireless network. I want to transfer data between app and linux process.
A simple use case can be, controlling a PC game from android device. I am looking for some standard solution for this kind of problem
Your best bet is probably to implement a Web Service on the machine you would like to control. This will make it so you don't have to invent your own protocol and deal with sockets, and it will give you a lot of control and ease compared to something like SSH.
Related
I am currently trying to write an android App that is connected to a application running on a pc (even though windows is preferred linux would be ok, too) via either USB or Bluetooth. Right now I'm not really sure how far this is possible. As far as I understand the USB Android API, I can not really use USB to talk to another application. Only raw file exchange seems to be possible. The Bluetooth idea seems a lot more feasible as I see it. I'd write a bluetooth server for the PC and connect to it via a Bluetooth client written via Android API. Point is, is that possible with windows? Has anyone seen any examples for what I am looking for? All I can find for USB is teethering which is not what I want.
There are android applications which allow you to use your mobile's touchscreen act like a touch pad which can be used to control your pc or laptop via bluetooth or wifi connection just like you are using your laptop's touch pad. PremoteDroid, RemoteDroid, Gmote etc.. to name a few (or only these are available i guess!).
But to do so you also need to develop a server application which will run on the device you wish to control and help u make connection between your mobile and the device. I have used PremoteDroid and RemoteDroid and they both work well on my laptop which runs windows 7. You can even add keyboard functionality.
PremoteDroid is openly available here: http://code.google.com/p/premotedroid/
I have a Bluetooth server application on my Mac that I use to test an Android app I'm writing. The app will eventually be used to communicate with a device with a microcontroller and bluetooth modem, but I needed a way to test the app in the absence of that device. The server app is written in Java, so I think it should work on a PC (and almost certainly in Linux).
I'm happy to share the code with you--I found it somewhere on the Internet (though I can't seem to figure out where now) and modified it as I needed to. It uses the BlueCove library, and is only about 60 lines, including several imports (and the code I commented out but didn't bother deleting :). I also have a Bluetooth client program on my Mac, since my app also has server functionality.
I have never tried to do anything like this using USB.
I am wondering how I can possibly stream data from an android device to my development PC. What I am actually trying to achieve is to stream some numerical data over to my PC and plot them in gnuplot in real-time.
Any ideas ?
In a development environment, I assume your phone and PC are on the same network (wifi, or even via USB/ADB which can be used to relay network packets). If that is the case, simply write a TCP/IP server (or web application) that runs on your PC, and have your Android application connect to it and provide the data.
Disclaimer: I work for Realtime.co. No, I'm not trying to sell you anything. Just trying to help.
Another thing you can try is using a cross-platform communication layer such as Realtime.co. It has an Android API as well as other APIs such as Java, PHP, .Net, iOS, JavaScript, etc.. So you can actually use it as your communication layer between your phone and any platform you need to be using on your computer (a browser, a Windows application, a Java, application, etc.).
I hope that helps!
I'm trying to write a program, which allows me to get a live feed from the phone camera on Windows PC.(What technology is the most suitable for this task ).
Wi-Fi is the best bet. Bluetooth might also work with SPP. USB is a non-starter.
I need to create an application that control PC mouse(pointer) through android device without downloading a server on pc, it should be able to communicate directly with my pc I already checked out the remote droid application but the user would need to download a client server to communicate with the phone
so is there way to remote control pc mouse through phone without downloading a client server on pc?
note: I am working on android 2.3.3 thus i cant use wifi direct and usb accessor
Why not just simulate regular bluetooth mouse, a standard bluetooth mouse which has its drivers as part of most os's.
no one can control your pc remotely without bluetooth pairing.
in theory i think it should be possible, but it requires knowledge in hardware and low level software (so its not a task suitable for most developers).
It doesn't matter what the client is, the fundamental question is "Can you move the mouse cursor on your PC from anywhere without installing software"
The short answer is no - which is a good thing! Otherwise, anyone on your network could just take control of your PC...
That said, you could, in theory, create an RDP (Remote Desktop) connection and use that to control the PC as a whole - but that is very complex, has been done already and would still require the user to allow remote desktop connections to the computer (Control Panel->System->Advanced->Remote)
Edit - Bare minimum app:
There are a number of ways to approach this but the absolute simplest app I can envision involves having an application on the PC listen for connections on a TCP/IP port. You'd then send messages to this port from Android using the Sockets classes.
The app would receive these messages, parse them and perform the appropriate mouse actions.
Make sure that you include an authentication/authorisation mechanism - you don't want random strangers to be able to control your PC just because they broke your wifi.
You may find it easier to build the desktop app to accept messages using the HTTP protocol (RFC) - This is a standard, widely used and very flexible mechanism for client-server communication. Why reinvent the wheel? This would also make your Android-side code far simpler as you could use HttpURLConnection and other similar classes which abstract the complexity of managing sockets.
You may also want to consider if the app should provide any feedback to the client - eg the new mouse position or a success/failure.
NB: Running the app as a windows service or website might seem preferable to a desktop app (doesn't need to be started by the user, nothing in taskbar/system tray) but there are considerable drawbacks to both - Windows services can't interract with the desktop easily (what happens if nobody is logged in?) and websites run as a different user so in addition to not having the same desktop, they have limited permissions.
It might be a case that i misunderstood the point. I think however that you can play with the BT protocols. If you find a way to recognize the phone form the pc like a BT mouse you can control the pointer. I think some of the low end SonyEriksson phones had that option build in.(SE880i).
Though I am not sure how the driver problem will be solved.
Regards
TT
If it is possible to plug into PC's USB Then
Arduino mouse using a cheap Arduino board
https://www.arduino.cc/reference/en/language/functions/usb/mouse/
Arduino wifi or bluetooth using same or another board (or connect by Serial, UART, SPI, I2C cable).
software on cell phone (Android) to connect to wifi/bluetooth
Some hacking at the C level.
Notes
- no driver on the PC
- Could do the same with PIC32 (even with
PIC8/16 but might take longer).
This is a typical real world IoT type project.
As a project it is between 40 and 160 hours to demo prototype for an experienced consultant. Parts cost estimate under $400 besides cell phone cost.
120 to 500 hours for 20 production prototypes + layout and assembly cost about $4000.
Production target unit cost under $25.
In other words a neat Kickstarter project.
Experienced soft/hardware & lucky hacker could do it 24 to 36 hours.
In Micromax q2+ Iam able to access the bluetooth - remote control and after pairing be able to move the mouse to my pc. One thing is am unable to do any action events.
I am thinking to try writing an app that can use android phone to remote control the desktop.
Just want to make sure my concept is correct.
So for the android able to
communicate with the desktop, I will
need some kind of protocol like...
maybe Bluetooth? In my desktop, I
should have a service app that open
Bluetooth connection for my Android.
Is Bluetooth is a good connection
for writing remote control?
Is it possible to use the Bluetooth
receiver from mouse to do the same
thing?
If you want to start with remote desktop I really recommend to you to first do a Desktop pc version before starting with the Android version.
Like Teamviewer. I recommend to do it with WiFi (WLAN) internet. Bluetooth needs a distance of maximum 20 metres. But if you want to do it fast, Bluetooth (instead of WLAN) could be better to do a presentation in the same room.
If you want to access the screen by using your phone, you need to access the mouse on desktop pc (Using of Mouse's bluetooth is not really possible). I think that is very simple. You also need to drive the keyboard. The difficult thing here is to do it with correct keyboard settings and character transmission.
Keyboard Hook
Also one of the most important things is to get it quick: Use Port forwarding on your router and on client side. That is a very tricky thing, Teamviewer is one of the best applications I've seen. They do not need it but still are working quick and direct.
Also take a look to your streamed images. Best way is to use MPEG4. But could be very tricky.
I would do it in the future with my WP7 and a DotNet app. Perhaps we can work together.
Yes, it can be done using Bluetooth, but a better option would be to use WiFi because it has more range and higher bandwidth. You can use sockets to communicate between mobile and desktop. Java provides a class java.awt.Robot which you can use to simulate mouse and keyboard events.
robot.keyPress(KeyEvent.VK_N);
robot.mouseMove(x,y)
Robot class also let's you capture screen, so it is possible for you to replicate desktop screen on mobile just like teamviewer. The complete process of creating an android based remote control is detailed here