有没有办法让Android的当前进程名没有办法、进程、Android

2023-09-12 09:36:02 作者:远赴惊鸿宴.

我设置一个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 ,按this螺纹。

If I've understood your question correctly, you should be able to use ActivityManager, as per this thread.