当用户通过拨号器或联系人进行电话呼叫时,我希望将其列为可以管理它的应用程序之一,就像Skype或Viber或其他手机应用程序一样.
我尝试了很多不同的解决方案,比如在清单文件的接收器中添加以下intent-filter:
<intent-filter>
<action android:name="android.intent.action.CALL_BUTTON" />
<action android:name="android.intent.action.CALL" />
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="tel" />
<data android:scheme="dial" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
stackoverflow上关于它的所有问题对我没有帮助; 它们含糊不清,不起作用.
编辑:尝试将intent-filter也放在activity manifest标签中.结果相同.我也尝试过使用CALL_PRIVILEGED操作,即使它不应该被第三方应用程序使用:
<intent-filter>
<action android:name="android.intent.action.CALL_PRIVILEGED"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="tel" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud) 我想打开我的电话拨号器。但它显示错误。我已经在 Android Manifest 上声明了 CALL_PHONE 的权限,也在 Android Manifest 中声明了类。
case R.id.action_call:
Log.d("Action_call","INside Action call");
Intent dialer = new Intent(Intent.ACTION_DIAL);
startActivity(dialer);
return true;
Run Code Online (Sandbox Code Playgroud)