I am currently developing an android app and needed a function that starts a phone call so I added this code.
public void dialPhoneNumber(String phoneNumber) {
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:" + phoneNumber));
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}
}
.. it seems to work perfectly in older android versions but when I test it in android 11 it doesn't function at all I tried action_call
and added the permission <uses-permission android:name="android.permission.CALL_PHONE" />
still doesn't work.