Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native Android launchMode singleTask getLaunchOptions doesn't get called again

Tags:

react-native

I am developing a react-native app for Android. The app takes image sharing with this intent-filter on the main activity

<activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
    android:launchMode="singleTask"
    android:windowSoftInputMode="adjustResize">
    <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.SEND_MULTIPLE" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="image/*" />
    </intent-filter>
</activity>

I am able to get the initial sharing intent images by overriding getLaunchOptions(), but with this default launchMode="singleTask", I am not able to get new sharing intent when I have the existing instance of the app running.

So, how can I get the new sharing intent while have an instance of the app running?

PS: changing the launchMode to standard to standard kind of solved my problem, but that will create multiple instances of the app.

like image 967
Morio Avatar asked Oct 24 '25 17:10

Morio


1 Answers

 <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
like image 168
Dishant Chanchad Avatar answered Oct 26 '25 13:10

Dishant Chanchad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!