I know how to develop in Android and use the Apache HTTP lib, but I want to go lower, get hold of the wireless interface adapter and be able to send & receive packets wirelessly. I know its possible since there are sniffer apps in the android market. I have looked around and googled a lot, but can't seem to get any ideas on how to even start. Surprisingly nobody seems to have asked this question on SO before too.
I suppose there is no android API that does it for you. Please suggest a way of sending/receiving packets in android or post references to any such resources.
Thanks!
Note: I know java.net api can be used in android (though I haven't used it before) but that doesn't give me the kind of access I want.
There is no way to do this with the standard SDK/NDK.
On a rooted device, you could possibly call into tcpdump, or another libpcap-based application. There is not a supported way to give Java applications the required privileges on a production Android device.
For example, this blog post describes how to use tcpdump to do a basic packet capture on Android.
Did you have a look at the NDK? Maybe you can do what you want in C(++).
Android OS 4.0 or later provides a VpnService through which you can monitor the network traffic. Application provided at http://www.taosoftware.co.jp/en/android/packetcapture/ uses VpnService that capture the data.
Related
What protocol does an Android TV Remote use? Seems like Anymote is no longer used. But there are still applications like Android TV Remote Control and Remote Android TV which work quite well with even the newer Android TV's. Can someone please point out any official / unofficial documentation to write such apps?
An Android TV is capable of being controlled over either Bluetooth or over WiFi. It would be great if either one of this follows an open protocol that can be incorporated in to say a Python or Android program.
Few Clarifications based on the various comments and replies:
Anymote is most certainly not the protocol in use any more (unless it's hidden and can still be used somehow in an undocumented fashio)
The ports that Android TV remote uses currently (6466/6467) is different from the Anymote standard ports (9552)
The old open source GoogleTV remote application no longer works with AndroidTV
I still do see "_androidtvremote._tcp" being advertised through mDNS - so there is a way to control it over TCP.
The Google TV Remote application uses Google's Anymote Protocol, which any application can use to create second screen style applications. There are several pieces to the Anymote Protocol.
Not a sufficient answer, but may help anyone looking:
I have recently got in the same situation as you.
From my finding, I suspect the pairing protocol is implemented in some Android core library (the com.google.polo.* java package in old references).
At the moment, search engines only yield this one repo archive of legacy code.
I tried to adjust the various (obsolete) polo & protobuf versions together, but I always get a different error.
I think the solution would be to locate an up-to-date polo library (from the Android SDK?).
I know that you indicate that Anymote is not used in GoogleTV, but from a quick download of its source code, it appears that Anymote is used.
com.google.android.apps.tvremote.protocol.AnymoteSender
The only other "sender" I can see in the protocols is a "DummySender" (noop) and a QueuingSender (delays until a Sender is ready).
The source code for GoogleTV is here. If there is any other protocol available, it will be referenced in this source code.
I would double-check other items to ensure that a pairing issue, the wrong device discover, or another thing isn't blocking your progress with Anymote.
I need to utilize both a barcode scanner and a USB port on something handheld. I figure a small Android Tablet is my best option.
I've spent some time researching and I cannot find anyone who has implemented a NativeScript App w/ Serial Port communication on Android.
I am concerned this means it is not possible, or prohibited for some reason.
I have the Serial Communication functional right now using Nodejs and the serialport module via NPM.
Does anyone know if this module will work in a NativeScript app?
I am going to attempt to make this work over the weekend, but before I waste a lot of time I figured I would ask in case this is simply not possible -- I've chased simple bugs for days so I could waste a long time on something that's not possible. :)
Thanks for your help!
Anything you can do with a pure Java-only app (or Swift/Object C for iOS) you can do with NativeScript as you can access all the underlining APIs. This is one of (if not the) key differences between NativeScript and other technologies. See the NativeScript docs.
Most probably, you'll want to use some third party code to communicate with the serial device (such as usb-serial-for-android). Here's a great blog post on how to use third party code in your NativeScript app.
I'm looking to get access to get low level network information on an android device that isn't available through the api. Is there a way to talk to the RIL to get more information?
Yes. I'm actually messing around that same thing. My hardware uses GSM radio and everything turns around the android internal API. (do a stackoverflow search with "[android] internal API" and you will get tons of info on how to access it). In my case, I'm interested in the data link over the GSM. So, it's in android source code in frameworks/base/telephony/java/com/android/internal/telephony/DataConnectionTracker.java. If you are interested in other features like SMS, SIM cards, voice call or anything that is not available on the standard "public" API, look in the folders frameworks/base/telephony/java/com/android/internal/telephony and the names are pretty relevant to what it does. As for a clear documentation, I did not find it. I think it's not publish since it is not recommended to use the internal APIs because it could change without notice and there is no guaranty an internal API will not change in the next Android version.
So I am a relatively new iOS developer but thanks to Stackoverflow, i managed to get peer to peer data communication for my app working without the need of a server using gamekit/GKSessions.
Basically, one iOS device acts as a server and others just connect to it to receive app specific data.
Now, the app is currently being ported on Android and I was wondering if there is a way that I can make an Android device connect to the iOS app and behave the same way as ios app does.
Android developers suggested alljoyn to be an optimum solution for android but that doesn't seem to be available yet for iOS.
Please suggest if you have any ideas on this front.
If there is a solution that involves rework on iOS side as well then I am open to it!
In case, you or others tackling the same question in Jan 2013 needs an answer,
AllJoyn is now ready for iOS too, amongst other platforms.
https://www.alljoyn.org/docs-and-downloads
Venkat i suggest you to read and get some detailed information regarding P2P. This is a Good source, because you might get stuck if both devices are behind multiple Nat. but if your willing to go forward there is always a way. My suggestion would be an Relay, but you need to have a server, but the relay behaves like P2P. Look at the source above to get ideas.
I didn't have time to wait for alljoyn to be launched for iOS and sensing no other feasible solution that would fit on my timeline, I implemented a relay server in between to achieve this.
For others though, iOS binding is now available for alljoyn (www.alljoyn.org).
I haven't tried it yet but the android version of my app works with alljoyn and it works perfectly so I assume it will do the same for iOS as well.
One limitation to be considered using alljoyn is that it cannot communicate between devices that are behind different subnets.
I think there is a limit of max peer to multiple peer connectivity (max 8 peers) derived by IOS and Android, there is no connectivity tested using alljoyn between IOS and Android devices
I want to Programmatically create vpn profile; somehow i figure out how to access android.net.vpnmanager and android.net.vpn.vpnprofile (they are not part of offical API and are part of hide APIs) but they have no function create new vpn profile. any suggestions?
Using Hidden APIs is not a good idea as there is no guarantee that with an update they will still work as intended, moreover there is no guarantee that they will work in a consistent manner across different devices manufactured by different vendors.
Android 4.0 ICS has a VPN client API but again it allows you to create your own VPN client.
The only reason I can think of as to why you cannot access VPN settings just as you will access wifi settings is the inherent nature of VPN connections. Here is a link to the VPN features in ICS4.0. The first part of the document discuss these risks. You can still write your own client for your app.
http://developer.android.com/reference/android/net/VpnService.html
Another approach can be to use a third party VPN client and check if you can pass any actions to it via an intent. My recommendation if you are targeting ICS only will be to go with the client API as that you know how your code is working.
I thinkt that VPN Android isn't yet on a stable release, there are a couple of other clients besides the built-in there. But there's so many changes between the last versions of Android regarding the VPN and proxy settings. At the beginning there aren't any VPN support at all, then you can only get that rooting your device and now there's a kind of stable native VPN client inside Android but like you noted, lack of documentation in many aspects and other bugs too.
My recommendation would be to wait to create your code after we have a slightly more stable VPN Android and documentation. If you can't or don't want to wait, go forward with that undocumented API, it could change in the future but I don't see any better option right now.
If You are using a phone from Motorola look into using this as it has code to create working vpn connections using L2tp and Pptp
http://developer.motorola.com/docs/Motorola_Enterprise_Device_Management_SDK_Getting_Started/