In my app, I am creating a Activity
with several TextView
that collects the information from a database in SQLite
integrated in my app, and one of the data is the phone.
My intention with this data, was to be able to create a button in the same Activity
, that when pressed, it will make the call to the phone of the BD record that is shown on the screen, but I have found that for each Android version is done in one way, for example:
For Android 5.0:
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setPackage("com.android.phone");
intent.setData(Uri.parse("tel:" + number));
context.startActivity(intent);
But for Android 6.0 I have no idea how to do it and of course, not only has to be for the latest version, but it has to be compatible with the others.
My question is:
How do I create a permission to make calls compatible with Android 6.0 and earlier?
I hope you can give me a hand and an example. :)
Thanks to everyone in advance.