所以我在这里遵循这个教程,将我的短信设置为默认,但由于某种原因,我的代码无效.我试图尽可能多地查看,但所有内容都指向同一个教程或已经过时.我也需要接收器吗?谁能解释我做错了什么?
代码:
@Override
protected void onResume()
{
super.onResume();
Log.i("MainAcitvity", "On Resume Called");
// Only do these checks/changes on KitKat+, the "mSetDefaultSmsLayout" has its visibility
// set to "gone" in the xml layout so it won't show at all on earlier Android versions.
final String myPackageName = getPackageName();
if (Utility.hasKitKat())
{
if (Utility.isDefaultSmsApp(this))
{
// This app is the default, remove the "make this app the default" layout and
// enable message sending components.
mSetDefaultSmsLayout.setVisibility(View.GONE);
}
else
{
Log.i("MainActivity", …Run Code Online (Sandbox Code Playgroud) 添加InCallService了Android API级别23,以提供用于管理电话的用户界面。该文档提供了清单注册示例,但我无法使它正常工作。该应用可以正常编译,但设置中的默认应用不会显示我的应用。
我发现有关该主题的任何信息的唯一地方是一年前关闭的StackOverflow问题。对提出增加android.intent.action.DIAL活动的那个问题发表评论,但这也无济于事。我在活动中也尝试了其他其他意图的组合(android.intent.action.CALL_DIAL和android.intent.action.ANSWER)。
是否有替换手机应用程序所需的代码示例?这些类是否需要提供一些工作方法供应用程序显示?
android android-intent android-6.0-marshmallow android-7.0-nougat android-7.1-nougat