In my application I open the browser. The web view should make a call when corresponding button is pressed.
For this I have added a permission to my manifest:
<uses-permission android:name="android.permission.CALL_PHONE" />
I user a following code in my activity:
protected class MyWebClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.startsWith("tel:")) {
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse(url));
startActivity(intent);
}else if(url.startsWith("http:") || url.startsWith("https:")) {
view.loadUrl(url);
}
return true;
}
}
This combination functioned well for 6 months. But today I have suddenly receives the error message:
Call requires permissions that may be rejected by user
I cannot undersatnd, what is actually required. I tryed to add an annotation @RequiresPermission
, but it does not see CALL_PHONE
from my manifest.
What should I add?