I am working on a dialer app using react-native and want to give my app option to open any phone number. So I added this to my manifest file.
<intent-filter><action android:name="android.intent.action.MAIN"/><category android:name="android.intent.category.LAUNCHER"/></intent-filter><intent-filter><action android:name="android.intent.action.DIAL" /><category android:name="android.intent.category.DEFAULT" /></intent-filter><intent-filter><action android:name="android.intent.action.CALL_BUTTON" /><category android:name="android.intent.category.DEFAULT" /><category android:name="android.intent.category.BROWSABLE" /></intent-filter><intent-filter><action android:name="android.intent.action.VIEW" /><category android:name="android.intent.category.DEFAULT" /><category android:name="android.intent.category.BROWSABLE" /><data android:mimeType="vnd.android.cursor.dir/calls" /></intent-filter><intent-filter><action android:name="android.intent.action.VIEW" /><action android:name="android.intent.action.DIAL" /><category android:name="android.intent.category.DEFAULT" /><category android:name="android.intent.category.BROWSABLE" /><data android:scheme="tel" /></intent-filter>
and I am trying to access the phone number and then pass it to the react component as props. but the phone number value is only received when the app starts and I want the phone number whenever the user clicks on any phone number.
@Overrideprotected void onStart(){ super.onStart(); Intent intent = getIntent(); if(intent.getData() != null){ Toast.makeText(getApplicationContext(), intent.getData().toString(), Toast.LENGTH_SHORT).show(); } else{ Toast.makeText(getApplicationContext(), "No Data", Toast.LENGTH_SHORT).show(); }}