I've written a an app and I'm having issues finding a solution to tcpdump data from the Android device running said app.
Android:
The only solution I've found is to root your phone (https://code.tutsplus.com/tutorials/analyzing-android-network-traffic--mobile-10663). Although this is not always possible. There needs to be a way to perform analysis via adb or Android Studio. Unfortunately I have not found a way to do that.
Additionally I've tried PCAPdroid which is an app. This does not seem to be giving me all of the packets I expect to see.
iOS:
Apple provides a feasible solution to create a virtual interface with a connected device where you can then tcpdump all traffic leaving said device.
https://developer.apple.com/documentation/network/recording_a_packet_trace?language=objc
Related
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 that takes a video capture of the screen by taking individual snapshots. I've been looking into taking the snapshot without root, and seems that most solutions use ddmlib and require the device to be constantly connected via USB.
The only solution that doesn't require root and a constant usb connection is the android screenshot library. However, from the forum comments as well as my experience with the demo app, this library doesn't work very reliably/consistently.
Is there any other solution?
Note: I've also looked at the Noroot Screenshotit app (https://play.google.com/store/apps/details?id=com.edwardkim.android.screenshotitfullnoroot&hl=en), and seem like they have a similar approach to the android screenshot library, but have no idea how they make it more reliable. If anyone has an idea, that would be helpful as well.
Thanks
Edit: We've already got the USB-connected implementation, but we want to be able to do it on the device alone, without needing any connection to another PC.
As of Android 5.0+, you can use the new functionality in the SDK called media projections to do screen capture without root privileges or a USB connection. There is sample code by Google available here.
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 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.
I am looking for a way of displaying an analog video stream on an android phone. On a pc/mac/etc you can achieve this using a cheap usb analog-digital converter such as a grabby: http://www.terratec.net/en/products/Grabby_82248.html, and then view on VLC, for example.
Would such a thing work (in theory) on android if the proper drivers were available? (ie. are there any hardware issues which make this impossible?)
Does anyone know if such a device with android drivers is available?
Ultimately I want to make an app which interfaces with the grabby (or similar device) and allows the user to view video on the android and capture and send short clips.
First of all the Android device needs to support USB Host. This limits your userbase significantly.
Then there is the problem with power. Some USB Host devices will be incompatible simply because an Android phone will not be able to push enough power through to port to get it running properly.
I'm not sure about the drivers, but I'm 99% sure it won't work "out of the box".
You should certainly take a look at THIS project. It is pretty similar to what you are trying to do. Maybe you should consider getting in touch with that person.
EDIT:
Based on what it took to get that DVB-T dongle running in the project i mentioned above the chances of creating an app that everyone will be able to simply download and use are EXTREMELY slim. Getting that dongle running required using a modified kernel and special scripts. Of course I could be wrong. You can continue the research yourself or wait for someone with more experience than me to reply.