有没有办法让Android的当前进程名 [英] Is there a way to get current process name in Android
问题描述
我设置一个Android程序=。 然而,当新的活动/进程init,它会调用我的应用程序:的onCreate(),其中包含了一些应用程序级初始化
I set an Android:process=":XX" for my particular activity to make it run in a separate process. However when the new activity/process init, it will call my Application:onCreate() which contains some application level initialization.
我想避免重复初始化通过检查当前进程名。
I'm thinking of avoiding duplication initialization by checking current process name.
那么,有没有一个API可用?
So is there an API available?
感谢。
推荐答案
如果我正确地理解你的问题,你应该能够使用的 ActivityManager ,按<一个href="http://stackoverflow.com/questions/8542326/android-how-to-get-the-processname-or-packagename-by-using-pid">this螺纹。
If I've understood your question correctly, you should be able to use ActivityManager, as per this thread.
这篇关于有没有办法让Android的当前进程名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!