Bluetooth trackball and screen mirroring - android

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

Related

Control android app using another android or iOS app

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.

Automatic screen cast(MediaRouter/Chromecast) on Android or other HDMI display alternative

We have a custom Android device with WiFi/Bluetooth antennae that we intend to operate without direct user interaction (like a router). Normal operation doesn't require any visible display, but troubleshooting or setup will. The device has an HDMI port for connecting to external screens but no built in display.
While we can plug in to an HDMI TV out of the box, the device will generally be in locations where big screens are inconvenient. We would like to make it convenient to display onto laptops or other small screens; the only other ports we have are USB-A receptacles, so I'm assuming any solution will be network (wired or wireless) based.
Edit: I had originally been looking at Chromecast before realizing it was an HDMI plug. Is there a simple way to cast to computers or is a hardware solution likely to be the most viable?
I'm still in the planning phases so will post more information as I run in to it. Am just trying to avoid writing a bunch of code that won't ever work; any alternative suggestions are appreciated. Thanks!
Previous text:
Does anyone have suggestions on how to approach this? My initial research led me towards using MediaRouter to connect to a Chromecast dongle (Device will run Android 4.4.2 ), but I'm unsure if the API gives enough control to find and connect without a display in the first place. I could only find examples of users selecting what to route to, and didn't see any proximity information in MediaRouter.RouteInfo to base make a decision based on (a la RSSI in Bluetooth). Finally, I wasn't sure if this supported devices list meant a custom device wouldn't work.

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 view other Android devices around you

I haven't seen this capability with any android app, nor have I seen anyone ask it. Is there any way that the Bluetooth or something can be used within your app to see a list of all the other android devices around you? For example, if my friend is using my app and he is in the same room I can see his device on a list in my app, and he can see mine...
There would have to be something that ties to two devices together, for example being on the same Wifi. As it is there is nothing that broadcasts to other devices that you are there by default. Even Bluetooth requires you to turn on discovery mode, or discoverable mode, and even then it will only stay on for a few minutes. If you wish for two devices to tie together, I am almost sure you could use the Bluetooth, but you would have to go through the normal process of discovery, synchronization, and permissions.
I don't think you can use BT to see what OS any phones around you are using, and they would also have to be set to discoverable.
If you want to make an app, it's possible to construct one where people agree to be located, but that's a voluntary issue, and it would be based on GPS radios in the various phones. I'm working on an app right now that has this capability, but again, it's something people sign up for so they can be located specifically for this purpose.
I would explore using the Google Latitude API as a possible avenue of exploration, before you reinvent the wheel creating a similar service.

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