This is a theoretical situation:
- I am writing an app to detect the presence of another on the phone
- The classpath, name, Activity names etc. of the target app have been randomized, I can't just check if it's there (it is semantically the same but syntactically unique)
- I have root access to the phone
- The app is open source, and (apart from the package name and application name) I know everything about it.
- The app generates no Log output.
I've been thinking of ways to detect whether this other app is present on the phone (assuming it is actually run from time to time), are the following methods feasible at all?
- Look periodically for the presence of certain classes in memory
- Search for known chunks of the compiled code in each installed apk
- Detect the app running by inspecting the memory of the device at certain intervals and look for usage patterns matching the app
Are there any other ways of detecting another app under these circumstances?
Use PackageManager. It has a method returning info about all the apps, installed on the system:
getInstalledPackages()
.