电信服务绑定在android

时间:2018-10-03 07:18:56

标签: android serviceconnection

谁能告诉我为什么电信服务绑定不起作用。

在api connectToTelecom ()中,

    synchronized (mLock) {
        if (mServiceConnection != null) {
            // TODO: Is unbinding worth doing or wait for system to rebind?
            mContext.unbindService(mServiceConnection);
            mServiceConnection = null;
        }
        TelecomServiceConnection serviceConnection = new TelecomServiceConnection();
        Intent intent = new Intent(SERVICE_ACTION);
        intent.setComponent(SERVICE_COMPONENT);
        int flags = Context.BIND_IMPORTANT | Context.BIND_FOREGROUND_SERVICE
                | Context.BIND_AUTO_CREATE;
                  // Bind to Telecom and register the service
        if (mContext.bindServiceAsUser(intent, serviceConnection, flags, UserHandle.SYSTEM)) {
          mServiceConnection = serviceConnection;
       }
    }

if(mContext.bindServiceAsUser(intent,serviceConnection,flags,UserHandle.SYSTEM))-此IF条件失败。

我收到以下错误消息:

4103:11-11 11:11:54.450 3311 3311 W TelecomManager:未找到电信服务。  4498:11-11 11:11:56.747 3311 3311 W ActivityManager:无法启动服务意图{act = com.android.ITelecomService cmp = com.android.server.telecom / .components.TelecomService} U = 0:未找到  5599:11-11 11:12:03.650 3796 3796 W TelecomManager:找不到电信服务。

http://androidxref.com/9.0.0_r3/xref/frameworks/base/services/core/java/com/android/server/telecom/TelecomLoaderService.java#mServiceConnection

0 个答案:

没有答案