Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 220.127.116.11 release ready!
Owner and Founder. Opencart
You must have seen several apps which opens a dialer with a specific number or even directly make a call to them. This functionality is quite easy to implement and very useful.
Let us look at the different ways to do the required task.
1) If you have a TextView which is displaying a phone number and you want to call on that number on a tap then this can be achieved by adding the autoLink attribute to the TextView.
But this one comes with a drawback that it doesn’t work for all kind of phone numbers. For example, a phone number of 11 numbers won’t work with this option. The solution is to prefix your phone numbers with the country code (09876543210 won’t work but +1569876543210 will work).
This doesn’t even need permission. Just add the attribute and you are good to go.
2) You can do the same programmatically also. The Intent.ACTION_DIAL will take you to the dialer screen all you need to do is add the phone number in the data.
The ‘tel:’ prefix is required, otherwise the following exception will be thrown: java.lang.IllegalStateException: Could not execute method of the activity.
3) If you want to directly make a call then this needs a CALL_PHONE permission. Add the permission in your AndroidManifest and change the ACTION_DIAL to ACTION_CALL in the above method.
Thank you very much. This is Vedesh Kumar signing off.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
The support is fast and do everything in their power to make it perfect. If you need customization it's also done right away. I had massive research to select Mobikul and now I'm sure it was the right one.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.