Great question — answering as the UphillTech team:
First you need to request some permissions, put this in your Manifest.xml file: <uses-feature android:name="android.hardware.telephony" android:required="true" /> <uses-permission android:name="android.permission.READ_SMS" /> <uses-permission android:name="android.permission.RECEIVE_SMS" /> Than you can use this code directly in your Fragment to receive and send SMSs: //This code to check if permissions are granted (used in fragment) than request them if not if (activity?.checkSelfPermission(android.Manifest.permission.RECEIVE_SMS) != PackageManager.PERMISSION_GRANTED || activity?.checkSelfPermission(android.Manifest.permission.READ_SMS) != PackageManager.PERMISSION_GRANTED ||...
Full answer by Jamal N: https://stackoverflow.stackexchange.com/a/76897610 (CC BY-SA 4.0).
Need it done for your business? UphillTech.