I want to be able to modify the application's process name programmatically. Normal C++ applications implement the main function which we can use to access the commandline arguments.
int main(int argc, char **argv)
....
Where we can then proceed to access the arguments such as using argv[0] etc and modify it as necessary.
Is it possible to also access such commandline arguments or equivalent in Android using Kotlin/Java/C/C++?
I have searched online and it seems that the Android environment does not allow this (as far as I have searched).
This has something to do with an application not being started with exec() calls and is started by the zygote process.
https://blog.codecentric.de/en/2018/04/android-zygote-boot-process/
I just want to know if it is doable in Android.
I have tried the following
prctl(PR_SET_NAME, "newname");
pthread_setname_np(pthread_self(),"newname");
However, doing a ps -ef
will still show the original process name