进口android.os.ServiceManager不能得到解决android、os、ServiceManager

2023-09-05 00:59:28 作者:醉人话

我使用AIDL接听来电自动的,code如下:

I'm using aidl to answer call automagically, code as following:

ITelephony.Stub.asInterface(ServiceManager.getService("phone"))
    .answerRingingCall();

我导入ServiceManager.class

I import ServiceManager.class

import android.os.ServiceManager;

但有一个问题:进口android.os.ServiceManager不能得到解决。

but there's a problem:The import android.os.ServiceManager cannot be resolved

我怎样才能使它发挥作用?谢谢

How can I make it work? Thanks

推荐答案

您好ITelephony是不公开的API的一部分,继承人的资源。

Hello ITelephony is not part of public API, heres the resource.

创建一个包目录自己,请参阅这个

Create a package directory yourself, refer to this

让我知道它的工作原理,我还没有尝试过呢!

Let me know it it works, I haven't tried it yet!