有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java默认手机应用程序意图操作拨号未打开活动

我正在为安卓开发一款默认手机应用程序,如:

具有清单中列出的权限和请求的运行时权限:

<uses-permission 安卓:name="安卓.permission.CALL_PHONE" /> 
<uses-permission 安卓:name="安卓.permission.READ_CONTACTS" /> 
<uses-permission 安卓:name="安卓.permission.DISABLE_KEYGUARD" /> 
<uses-permission 安卓:name="安卓.permission.SYSTEM_ALERT_WINDOW" /> 
<uses-permission 安卓:name="安卓.permission.ACTION_MANAGE_OVERLAY_PERMISSION" />
<uses-permission 安卓:name="安卓.permission.WAKE_LOCK" />

在请求这些权限之前,我已通过ACTION_CHANGE_DEFAULT_DIALER意图请求将其作为默认权限授予,然后权限和操作管理覆盖权限设置打开,供用户打开

在我的舱单上。xml我已声明服务InCallService实现:

<service
        安卓:name=".InCallServiceImplementation"
        安卓:enabled="true"
        安卓:exported="true"
        安卓:permission="安卓.permission.BIND_INCALL_SERVICE">
        <meta-data
            安卓:name="安卓.telecom.IN_CALL_SERVICE_UI"
            安卓:value="true" />
        <meta-data
            安卓:name="安卓.telecom.IN_CALL_SERVICE_RINGING"
            安卓:value="true" />

        <intent-filter>
            <action 安卓:name="安卓.telecom.InCallService" />
        </intent-filter>
    </service>

当用户启动安卓.intent.action.DIAL时打开我的应用程序拨号板的活动:

<activity
        安卓:name=".DialerActivity"
        安卓:label="@string/title_activity_dialer"
        安卓:theme="@style/AppTheme.NoActionBar">
        <intent-filter>

            <!-- Handle links from other applications -->
            <action 安卓:name="安卓.intent.action.VIEW" />
            <action 安卓:name="安卓.intent.action.DIAL" />
            <action 安卓:name="安卓.intent.action.CALL" />

            <!-- Populate the system chooser -->
            <category 安卓:name="安卓.intent.category.DEFAULT" />

            <!-- Handle links in browsers -->
            <category 安卓:name="安卓.intent.category.BROWSABLE" />

            <data 安卓:scheme="tel" />
        </intent-filter>
        <intent-filter>
            <action 安卓:name="安卓.intent.action.DIAL" />

            <category 安卓:name="安卓.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

还有我的拨号功能。爪哇:

@Override
protected void onCreate(Bundle savedInstanceState)
{
     if (getIntent() != null && getIntent().getData() != null)
    {
        Log.d("MainActivity URI :", getIntent().getData().getSchemeSpecificPart());
    }
    else
    {
        Log.d("MainActivity URI :", "NULL INTENT FOUND");
    }
}
  1. 我的InCallServiceImplementation在用户启动安卓时被调用。意图行动从呼叫按钮呼叫
  2. 但是,当用户在公司提供的手机应用程序中最近的通话中触摸电话号码时,我认为这是一个安卓.intent.action.DIAL,它应该打开我的拨号活动,但无论是在模拟器上还是在真实设备上都不会发生

for your reference you can see i am printing getSchemeSpecificPart in my DialerActivity onCreate which never gets called.. Why it is not opening the dialer activity? I would like to thank you in advance.


共 (0) 个答案