0

I'm currently working on implementing a feature that handles video links received through the YouTube sharing functionality in my application. However, I encountered an issue where if this handling is done in the background while the application is running, it causes the application to be launched again. So, to prevent multiple instances of the application running, I set the launch mode to "single instance" at the end of the AndroidManifest file. But now, a problem has arisen where when I share a link through the sharing feature, the intent in my application reads as null. This has put me in a difficult situation. What should I do?

This is my onNewIntent() at my Activity

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        Log.e("onNewIntent", "intent: " + intent.toString());
    }

This is my Activity manifest

    <activity
        android:name=".MainActivity"
        android:exported="true"
        android:launchMode="singleInstance">
        <intent-filter>
            <action android:name="android.intent.action.SEND" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="text/plain" />
        </intent-filter>
    </activity>

Ultimately, I just need to be able to successfully receive the links through the YouTube sharing feature using the application instance running in the background. Therefore, I would appreciate any other advice or suggestions you may have.

0 Answers0