As FrankDev said, you have to put the code in the Manifest Editor to make it work:
AddActivityText(Main,
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>)
But you also have to put:
SetActivityAttribute(Main, android:launchMode, "singleTask")
Well, it is necessary to configure launchMode in singleTask, instead of the singleTop predetermined by B4A internally or by Android, because if not, if your application was previously open, it creates another task of the same app, so there are two tasks of the same application at the same time on your device.
This automatically closes the first task so that the user is not confused by choosing it in the recent Android applications view.
This problem appears as of Android 6.
Regards.