Android app that sends and receives data from pc - android

So ill do my best to explain. I'm wondering how easy (or hard) it would be to make an android app that talks/sends and receives data from a PC or mac, even more so with flash.
so for example, I first make a flash application on my PC / Mac, lets say it has a MovieClip of a square on the stage. That is all for that part. Next I make and android app that consists of one button. when I press that button (on the android app, on the phone) the square on the flash desktop application moves to the right or left by ten pixels.
so ultimately the mobile app is controlling the desktop flash application.
Iv searched and searched but I'm unsure of what keywords to really use to find what im looking for.
Can anybody shed some light on how difficult this is(if its possible), or any documentation / tutorials on this subject?

The Bluetooth standard includes a profile called Bluetooth HID. If you write (or download!) an Android app that implements this profile, then connect your Android device to your PC, it basically becomes a Bluetooth mouse or keyboard. It would require no programming on the PC side, as both Windows and Mac support Bluetooth peripherals.
Implementing a network protocol on the device side is usually really low-level stuff. If your programming experience is only in flash, you'll probably find this tough going (you would likely learn a lot!). Luckily, there's the Android HID library. I don't know how good it is (I just found it for this answer), but it looks done, so it would save you from having to do the most difficult parts.

You can use adb to accomplish this, which is how many of the tethering apps get around carrier restrictions. Here are some sources:
Adblib is a "library to communicate with android devices with TCP over USB without requiring the Android SDK":
http://code.google.com/p/adblib/
Thread about Adb over USB:
http://groups.google.com/forum/?fromgroups=#!topic/android-developers/JsDTBimHpOA
adb itself:
http://developer.android.com/tools/help/adb.html
Here are some other links to some other Android USB topics:
http://developer.android.com/tools/adk/index.html
http://developer.android.com/guide/topics/connectivity/usb/host.html
http://developer.android.com/guide/topics/connectivity/usb/accessory.html
http://developer.android.com/reference/android/hardware/usb/UsbInterface.html
http://developer.android.com/sdk/win-usb.html

Related

How to test Chromecast apps without a TV?

Background
I'm planning to make an app that casts things (urls, content,...) to chromecast .
I've bought a ChromeCast dongle, and it worked fine using the samples of Google.
The problem
It's quite annoying to have 3 screens to look at while developing such apps, and I'd prefer to have the receiver on the PC side too.
Such a thing would also make it much easier to debug and test.
What I've tried
I've searched for this a lot, and found some Chrome plugins (like CR Cast), but they all have terrible bugs. I've even found a python based solution (here), but I failed to compile it.
I've noticed that there is a reciever side description of ChromeCast in the documentation. Does this have anything to do with a replacement of ChromeCast?
The question
I'd like to know if it's possible to do the testing on the computer itself, including all of the features that ChromeCast has.
Unfortunately there is no replacement for testing a Chromecast other then testing on a Chromecast been developing on CC for 3 years... (If someone knows how please enlighten me).
The receiver web application that is run on the CC references Google JS libraries that are dependent specifically on CC hardware and must run on the devices builtin browser.
I've been in the similar situation where while traveling I had no access to a TV and needed to fix a CC issue. In this case I would recommend just plugging the CC into USB (to power it) and leave the display out of it. The CC has no dependency on being plugged into a display to function and it will operate, stream, log events just the same. Then just access its remote debugger on the CC's IP address and port 9222. Every log regarding its operation will be there and you can inspect the HTML (But you probably know this).
The Chromecast connects to a TV via an HDMI port which is available on most monitors. You may simply connect, if your monitor has an HDMI port. Modern monitors support the latest HDMI protocol, so you will be able to get video and audio. I am currently using this setup using a NEC MultuSync EA275UHD. The output is visible by switching Inputs but there is also a PIP mode on the monitor that allows the screen to be slit to view the Chromecast and Desktop output side by side or with one of them scaled down and overlaid near a corner.
Now, if your computer screen does not have an HDMI port, you can get converters but sometimes you will lose features. A HDMI to DVI for example will be limited to Full HD and not transmit sound. DisplayPort adapters can handle 4K resolution and audio, but read the specs because not all do.
The last and more expensive option is an HDMI capture card or adapter. That will let you see the display on a laptop even. The advantage is that you can even record the output for demos, for example. Those costs from $80 to $400 USD, depending if they can capture 4K and at which refresh rate.

Connecting android app with application on a pc

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.

How do you develop Android apps with Bluetooth?

How do you effectively develop, debug, and test an android app that is based on Bluetooth.
I have been googling and searing stack overflow for the answer to this question and I am not getting a clear answer.
I understand that the emulators do not support Bluetooth. I also know of various guides explaining the functions, classes, and such, and I know people have mentioned that setting up a Bluetooth emulator is possible with Virtualbox. I even came across some old projects like BT-Sim that seemed like a way to create fake BT signals (though if my android emulator doesn't support BT, it doesn't help too much)
But no solid guide on how to get this going. It just likes a few scattered puzzle peaces that need to be stitched together. It makes me wonder how app developers reliably make BT enabled apps?
Are there any guides that dissect how to do this process? I imagine the steps to accomplish are:
Create a custom emulator on Virtualbox that can simulate Bluetooth?
Get the AVD Manager to talk to this emulator so my compiled Android code will work with it
Run a Bluetooth simulator to send BT signals over a port in your computer
(I don't really know how to do either of those 3 though!)
My overall goal is as follows:
Create an app that will collect data from a Bluetooth transmitter
But first, create a simulator on my computer that can talk to my android emulator as if it were the real thing
I'll be honest, I do find it odd that the Google folks don't allow Bluetooth emulation on their AVD. I understand not allowing real telephone calls, but I don't see how Bluetooth can be abused like that.
Anyway, any help in setting up Bluetooth would be greatly appreciated and hopefully help many others out there!
NOTE: I am using the standard Eclipse + Android SDK setup with AVD to do my Android development. Planning to use API 10. However, if I need to use a different set up, I am fine. As long as it comes with a step by step guide! That would be very nice.
Old question, but it's still unanswered. If you have a physical device, that seems easiest way to go. If, like me, you don't have a device it's still possible to develop with bluetooth and android.
Download an android x86 iso, load it into virtualbox with bridged network setting and install it.
Plug in your bluetooth dongle and select the device from the 'usb' menu, alternatively you can set a device filter in the vm's settings page.
Now just use adb and connect to it, you can find the ip by going to console (alt+f1) and typing netcfg or ifconfig eth0. You may also need to type adbd on the android console - I do, but I don't see many people mention it so seems it's not always needed.
It still works with eclipse, and is much faster than the emulator. Even when I'm not doing bluetooth dev I use the vm rather than the emulator.

how to control pc mouse from android device without client server

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.

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