aspose file tools*
The moose likes Android and the fly likes Listening socket connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "Listening socket connection" Watch "Listening socket connection" New topic
Author

Listening socket connection

jeet shri
Greenhorn

Joined: May 13, 2011
Posts: 1
Hi all

I am developing an android application in which i need to implement a background service which will will listen the socket connection made by any of the app of device.
in other words i want to capture the event when any app try to make server connection.
and then i want to fetch the destination ip address or domain name.

can any one tell me is this possible in android.
either by SDK or NDk


With thanks
jeet
Hauke Ingmar Schmidt
Rancher

Joined: Nov 18, 2008
Posts: 433
    
    2
I hope it is not possible on API level! What a security risc this would be - sandboxing, something quite important in Android, would be rendered useless. It may be possible at sytem level (e.g. TCP/IP stack, network driver).
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42286
    
  64
I wouldn't call it a security risk - with an explicit permission that the app would need to have (and which the user would need to agree to), it wouldn't be much different from installing apps that can listen to phone calls and SMS, or that have access to calendar and contact details, IMO.

Having said that, I'm nonetheless unaware of such a capability.


Ping & DNS - my free Android networking tools app
Hauke Ingmar Schmidt
Rancher

Joined: Nov 18, 2008
Posts: 433
    
    2
Maybe I was a little harsh. And there are legit use cases.

But it would mean that an app can directly control what another one does, by directly interfering with the output/input. This is something the Android designers tried to avoid with the concept of sandboxing, intents and loose coupling. The data objects you name (SMS, phone calls, contacts) are public objects in Android by design. When an app creates files it can create public or private files. I would expect a socket connection to be private, at least by default.

Even for taking screenshots (possibly reading the output of another app) you need an app with root privileges.
 
 
subject: Listening socket connection