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
Related
In what way could I control an android app from another app that could be on iOS or android?
My use case is I want to be able to control an android tablet that's part of a smart-home product. In this case I don't have direct access to the tablet's screen as it's encased inside the product. So I'd like to control the tablet via another android/ios app.
Specifically:
be able to connect the android tablet to wifi
could I host a server on the android tablet to be able to communicate with it once connected to the wifi?
For part 1 I was thinking I could do something along the lines of have the tablet be in AP mode and use the client app to connect to it, is it possible to update the tablet's wifi once that is done?
If you were writing both pieces of software you could, although I wouldn't recommend it- Android is not meant to be a server OS, the battery optimizations and unreliability of Services make it a poor choice. Plain old Linux would be better. But controlling a 3rd party app remotely? You may be able to make something work, kind of. Something like connecting via wifi debugging, rooting the device, and sending raw touch events via the /dev/ filesystem. But it will be fragile, prone to breaking, and really hard to do. You're better off looking into open source solutions, like OpenHab.
Is it possible to simulate a USB or Bluetooth device connected to Android?
I would like to make an app which is able to simulate an HID device locally. What I mean by this is: the app should make Android believe that an USB/Bluetooth HID device is connected. This would allow my app to inject touch events globally, I hope. Is there anyway to simulate a (virtual) device? Note that I don't really care about the device, I just want to use the built-in support for HID input.
I know a lot of people already asked about touch event injections but this approach seems to be a little bit different. I do not want to use this for testing purpose, so InstrumentationTestCase and the like won't help.
Rooting the device might be an option, although I can also imagine to ask my endusers to install a specifically signed app manually (according to https://stackoverflow.com/a/16737083/2923406 and https://stackoverflow.com/a/22902808/2923406 this works, but it would be device specific).
I am aware of:
Simulate a mouse input on android - This guy seems to do it in his own app, although his questions wasn't answered ;)
http://www.pocketmagic.net/2013/01/programmatically-injecting-events-on-android-part-2/#.U58SqfldVHV - Needs Root. Did anyone succeeded in using this? Also, the solution seems very device-specific again.
Bluetooth + simulating mouse - That's not what I want. The phone itself should not be an HID device, but use the (virtually created) one itself. Same for this:
https://stackoverflow.com/a/8174973/2923406
Note that I do not want to turn my phone into an HID device of any kind.
Simulating is a broad term. When I created my Bluetooth app I "simulated" a Bluetooth connection in two ways.
Way 1: Use a serial port UART converter and hook it up to a Bluetooth module transmitter.
Then you can use a terminal program like CoolTerm, to send your data.
Like so. In this case I coded in a string to send on successful connection with the device however you can make a infinite loop for testing purposes effectively not requiring your phone to be turned into a HID device.
Way 2 (not easy): Use your computers bluetooth in a server/client relashionship model.
This is harder to do. What you can do is convert your pc/mac into a server and the Android phone into a client or vice-versa. For this you will need to write external code which will need to be compiled separately on a jvm(java virtual machine). The procedure to do this can be found here. If you are using a Linux machine you have to separately download the Bluez module. I have not tried this on any other operating sytem other than Ubuntu, and it was a pain to get functional.
Hopefully that helped.
Yes, it's quite easy using the AOA2 protocol check this & this links for details ( you'll need to switch your device to the Accessory mode )
This may be possible (or at least be easier) using the Robolectric library, which simulates a full Android device locally. Although it is intended primarily for testing, the fact that it simulates a whole device locally - including Bluetooth and USB - means adding to it may be an easier approach.
In other words, you may be able to modify the classes it uses to simulate these abilities locally (i.e. in the IDE itself without an emulator or device) in order to simulate them on the device itself. After all, it does provide full simulations of these functions. You could simply change these Bluetooth and USB simulating classes to load onto the device itself rather than onto the local Robolectric test "device."
This is just an idea though - I can't confirm this will work - it just might be a good place for you to start.
I'm trying to make an app on an Android device that will control an application on an iPad or Android tablet. (I'm testing with an Samsung Galaxy S2 and an iPad 2).
The application is pretty simple for now. When one selects a colour on the Android mobile, that colour displays on the tablet device.
The question is, how to connect the two devices. Just now I've verified that I can pair the two devices using Bluetooth. Also, the Samsung has a "Kies" Wifi Direct feature (which I don't understand fully), that allows the iPad to connect to the Galaxy as a wifi hotspot.
The connections are there, but I don't know if either protocol can be used to actually get the apps to talk to each other to get the control I'm looking for.
Should I be using Bluetooth, Wifi, or something else?
And in whichever case, how?
My opinion is that you should not stick so much around the physical medium used for connectivity either is WiFi or Bluetooth. You should abstract this aspect, in both cases you will be using sockets (I'm speaking about Android), if it's Bluetooth you will be using Bluetooth Sockets, if it's WiFi: TCP sockets. You could have a intermediate layer that abstracts the type of connection and through a factory to use either Bluetooth or TCP.
Bluetooth - http://developer.android.com/guide/topics/wireless/bluetooth.html
For WiFi you should study if P2P would help.
You will need two applications:
- one on the tablet - the server which listens for commands from the client (change color, do this or this)
- second on the smartphone - the client which sends commands.
I've built a few apps that do exactly that between iPhone and iPad. But the principle is the same. I used Bonjour networking. It's just a fancy name for ZeroConfig networking between devices. It's written originally by Apple but it's open source so there should be Android support out there for it too. Really simple and easy to work with.
If you already have a working connection then you already have the first half of your answer, that said you should really consider implementing a solution that uses a variety of connection types, WIFI, Bluetooth, etc.. The question I think you are really asking is how to pass data and messages between the apps once you have the connection.
There are a lot of ways to accomplish this. You could implement your own lightweight message passing system. If you haven't done this before it is more complicated than it originally seems, especially as you would be required to implement the system for each OS you end up using.
Should I be using Bluetooth, Wifi, or something else?
It depends on what situations you want your program to work in.
Bluetooth can provide a direct connection between your devices. A potential issue with bluetooth is that it has a limited range. If you're devices need to be far away from each other, you may want to go with wifi. Otherwise, bluetooth could work great.
If both devices are connected to the internet, you can make them talk to each other through there. The advantage of this approach is that it doesn't matter how far apart your devices are as long as they're both online. A disadvantage is that you'll have to figure out how to find the tablet's ip address before you can talk to it. This is actually a HUGE disadvantage because it can be quite problematic if both of your devices are not on the same wifi. You could have the user type in the destination ip address, but you'll have problems getting it to work if the user is behind a router (which will almost always be the case). The point is, it gets hairy.
If both of your devices are on the same wifi, you can use ZeroConf AKA bonjour (like Dancreek said) to figure out what ip address you need to send info to. I've previously used a library called jmdns (easy to find with google) to implement zero configuration networking. It's good because the user doesn't have to worry about ip addresses... it's intuitive for the user.
And in whichever case, how?
Networking is a pretty big topic, so I can't expand on this question to much. Short answer is, it depends on what method you choose. Search for some tutorials and start by getting one of your devices to send something as simple as an int to the other.
I've very interested in a new project, but it requires the user be able to access the phone's display via a wireless trackpad and screen. I'm thinking bluetooth is the best way to go. I can find a few resources regarding the bluetooth classes, but I can't find any resources for mirroring the phone's display or manipulating the ui with a trackball using blue tooth.
Are these two things possible? Could someone give me some information or point me towards some resources?
So you want to remotely control your Android Device with a Trackpad using Bluetooth for the connection? Do you need this for the whole Android System or just for your App?
If just for your App, their should be a way of doing this since communication between two Bluetooth-Devices runs over Sockets (like Client-Server communication). See the Androids Bluetooth API. But I'm also not sure how you plan to make the Android Device understand the Bluetooth-Commands which the Trackpad is sending to it (if you can even get both of them to connect to each other).
If you need it for the whole System, I'm not sure if this is possible (without rooting the phone and maybe writing some drivers for it), as I don't know any way of emulating a touch/click on the screen (which is basically what you want).
Although I know that there are some experiments running to connect a Bluetooth-Keyboard with an Android Device. But their is nothing official yet and nothing to look into (like SourceCode) as far as I can tell.
But maybe I'm looking at this a lot too complicated...
I want to write a very simple application (maybe it is not so simple). I want to run application on my PC (either windows or linux) from the android phone. lets say I will have couple of buttons on my phone's screen and each button will open an application, say notepad or calculator. Or even better I will have an application on my computer screen (this will also be written) lets say 8 buttons on the appliaction and I will have same 8 buttons on my phone screen which will imitate as if I am clicking those buttons on my computer screen. I do not want to do this like GMote does by controlling mouse (touchpad).
I have some programming experience but not in Android. I dont know where to start so I will appreciate if someone could head me to the right direction.
Thanks in advance...
cs
The actual coding of this is fairly simple to accomplish. Basically you just open a TCP/IP connection and send and receive representations of keys and responses. There's a few things to learn about permitting easy reconnect when connection is lost and the like, but basically it's all vanilla TCP/IP client server programming in either native or java code, in the context of both the phone and the PC.
What's more complicated is the network topology that can connect the phone and the PC.
If they are both on the same wifi network it's pretty easy, just connect to the PC by its IP address.
But if you want to use the phone's 3g connection, it will be much harder. Chances are the PC you want to connect is not reachable from the external internet due to a combination of firewalls and/or network address translation, so the phone can't directly contact it. You may need to connect them by means of an internet server visible to both the phone and your [cable/dsl/corporate network] - connected PC.
Another possibility might be to get a bluetooth dongle for the PC and connect to it that way, though there can be a lot to learn about getting the PC side of the bluetooth interface working right and the APIs to program against it.
This is not simple at all. Probably in fact one of the more complicated things you could possibly do on android. Your description is extremely vague and it looks like you've put very little actual effort into this.
If you really want to pursue this, take a look at http://code.google.com/p/android-vnc-viewer/