How to get information about a file that is transmitted via Bluetooth, WiFi in Android

I am working on an application that will detect files that are transferred using WIFI / Bluetooth / in another way. It will also detect the application that performs this action.

If I want to detect file transfer, what would be the best approach?

I thought this could be achieved by the broadcast receiver for the Intent.ACTION_SEND action. But then I came up with @CommonsWare answer for this question.

How will this be achieved in my case?

+6
source share
1 answer

All applications are isolated in Android, so there is limited information that you can get from external applications regarding what they do. It is by design and it would be terrible if it were all open. But this does not mean that you cannot get any information from them. You can view data sent over the network using the TrafficStats API. Thus, you can continuously test these APIs for all UIDs and see which uid updated the tx and rx bytes. This will give you an idea of ​​how / when different applications send data over the network. This will not give you access to information about specific files.

Sample code to get all uids taken from here .

 final PackageManager packageManager = getPackageManager(); List<ApplicationInfo> installedApplications = packageManager.getInstalledApplications(PackageManager.GET_META_DATA); for (ApplicationInfo appInfo : installedApplications) { Log.d("OUTPUT", "Package name : " + appInfo.packageName); Log.d("OUTPUT", "Name: " + appInfo.loadLabel(packageManager)); } 

The traffic statistics API is found here .

Not sure how this is possible via bluetooth. This, of course, is different if you actually created other applications that you are trying to control.

0
source

All Articles