【问题标题】:How to implement CallScreeningService for Andoid<=28如何为 Android<=28 实现 CallScreeningService
【发布时间】:2020-12-18 05:12:07
【问题描述】:

**到目前为止我做了什么:**

我已经为 Android SDK 29 实现了它

 RoleManager roleManager = (RoleManager) getSystemService(ROLE_SERVICE);
 Intent intent = roleManager.createRequestRoleIntent(RoleManager.ROLE_CALL_SCREENING);
 startActivityForResult(intent, REQUEST_ID1);

**我在找什么? : **

我想为

【问题讨论】:

    标签: java android android-studio callblocking callscreeningservice


    【解决方案1】:

    很遗憾,你不能。

    在 Android 版本 RoleManager 类,因为该类是在 Android 29 上引入的。因此,您只能在运行 Android 29 及更高版本的设备上使用该类。

    【讨论】:

    • 其实我不需要 RoleManager。我只想为
    【解决方案2】:

    对于 Android

    if (getSystemService(TelecomManager.class).getDefaultDialerPackage() != getPackageName()) {
                        Intent changedDialer= new Intent(TelecomManager.ACTION_CHANGE_DEFAULT_DIALER);
                        changedDialer.putExtra(TelecomManager.EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME, getPackageName());
                        startActivity(ChangeDialer);
          }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多