0

I tried this using an app and I am able to identify most apps and their network connections however there are certain apps listed as '?' so apparently it is not able to identify a package name I would like to know how I can get this information on command line using termux or any other emulator. I am magiskaly rooted on an Android 10 phone

also would like to get a list of apps that can modify contacts and then revoke modification of contacts from certain apps by command line
and on command line how do I force kill an app I mean I can use the hang -9 Signal ....but I am sure there must be a more gentle package-level way of force stopping an app title the equivalent of getting inside the app property on gui and clicking that force stop button
also delete the cache on command line


what I want to do is write a `batch` script that will overwrite certain app specific files that the app keeps resetting every time and then force stop and clear `cache` and restart the app
0
2
  • If you mean by network connection the applications that has "android.permission.INTERNET" permission, then run this shell script:
for package in $(pm list packages -3 | cut -f2 -d":"); do
dumpsys package $package | grep "android.permission.INTERNET: granted=true" > /dev/null && echo $package
done;
  • If you want to list all applications that are connected to internet:
netstat -tuplna

That will list all application that has an established connection

  • If you want for each App an their mobile data usage:
for package in $(pm list packages | cut -f2 -d":"); do echo $package; pm dump $package | grep  "Mobile network"; done;
  • To kill an App:
am force-stop PACKAGE_NAME
  • Clear cache:
pm clear PACKAGE_NAME
1
  • 🌇🌄Good Morning 🌅🌇 thanks for responding I actually extended the question with some other related subs as well if you have a chance to respond to those .....will then gladly ✅ this off. Aug 20 '20 at 15:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.