How to implement mouse pointer and it's operations on android programatically - android

I am trying to implement a remote controller software. It is based on the idea that a smartphone, which runs android operating system on it, can remotely control a smartbox over WiFi. Problem here is, smartbox, which is connected to the Tv also runs android on it.
I am now working on mouse implementation for the both client-side (phone) and server-side (smartbox). Any coordinate changings on the touch screen of the phone will be transmitted to smartbox via UDP protocol over WiFi and smartbox will process the relevant coordinate changings on it. Problem is, I do not know how to show mouse pointer on android that runs in smartbox and how to manipulate setting/moving mouse cursor. I search this issue a lot on the internet but all the resources are based on android-to-Pc, there is no even one android-to-android remote controlling project like this.
As I mentioned before, if you give me any idea about how to implement and operate mouse pointer on android 2.2 (froyo) operating system programatically, I will appreciate it.
Thanks.

I suppose there is no Android-to-Android remote controlling because Android does not support mouse pointers natively.

Related

Simulate USB/Bluetooth HID device locally in order to inject events?

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.

How to control custom Android app via Bluetooth custom device

I'm building a Bluetooth device and would like to make it so that once it's paired with an Android device such as a phone or tablet (eg. Nexus 7) it will be able to interact with a custom app on the Android device in a transparent manner without any prior setup.
For example, the behavior I'm looking for is similar to that of a handsfree headset where once you've done the initial pairing you can push a button on your headset, issue a voice command, and it transmits commands to the phone and the phone does it's thing. I have built a Bluetooth device where when a button is pushed it should be able to immmediately send commands to a custom app on my Android device and the custom app should run and do its thing. This should all happen without putting the Android device into some ready state or having my custom app open waiting for commands; it should all be transparent without the user having to do anything (eg. the Android device could be in my pocket or bookbag).
I am a veteran programmer but very new to Android and Bluetooth and would appreciate pointers in the right direction. I imagine that perhaps I would need to install some service-level app on the Android device to implement my own custom profile and/or intercept the Bluetooth commands but these are just guesses; I'm hoping someone would shed light on the actual process so that I can read up on them in detail. I'm also hoping that the solution is a generic one that would apply across the board but right now I'll take anything I can get lol!
Many thanks in advance.

Connecting a remote touchpad to an Android system

I am thinking of connecting a remote touchpad to an android system (via infrared, bluetooth ...), for example for tablets or phones. But I don't know if it is possible to edit Android system in order to do that, or if there are already systems using the concept. I have seen articles talking about using android screen as a touchpad, but what I want to do is the opposite : using a touchpad to move a mouse cursor in an android system.
Thank you for your time !

Bluetooth trackball and screen mirroring

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

Writing Android remote control Desktop

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

Categories

Resources