Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

华为畅想9 #2

Closed
wynnforthework opened this issue Mar 24, 2019 · 1 comment
Closed

华为畅想9 #2

wynnforthework opened this issue Mar 24, 2019 · 1 comment

Comments

@wynnforthework
Copy link

wynnforthework commented Mar 24, 2019

畅想9/DUB_AL00 64G
Android:8.1.0
开启自动接听后
java.lang.SecurityException: Neither user 10121 nor current process has android.permission.ANSWER_PHONE_CALLS.

java.lang.reflect.InvocationTargetException

@wynnforthework
Copy link
Author

我已解决了,需要动态申请权限,运行之后,自己打个电话过去,权限弹出,点“始终允许”,后面的电话就可以自动接听了,配上自动录音效果更佳。

private final int ANSWER_PHONE_CALLS_STATE=1;

int permissionCheck = ContextCompat.checkSelfPermission(this, "android.permission.ANSWER_PHONE_CALLS");

    if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
        ActivityCompat.requestPermissions(this, new String[]{"android.permission.ANSWER_PHONE_CALLS"}, ANSWER_PHONE_CALLS_STATE);
    } else {
        Log.e("TTTTTTTTT","mMainHandler");
        mMainHandler.postDelayed(mRunnable, 1000);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant