Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion - documentation update #1041

Open
BTrottAtWork opened this issue Jun 3, 2024 · 1 comment
Open

Suggestion - documentation update #1041

BTrottAtWork opened this issue Jun 3, 2024 · 1 comment

Comments

@BTrottAtWork
Copy link

A helpful tip for android implementation if your react-native activity is not the same activity as the activity designated as your launch activity is to make sure you forward your intent extras to the activity that runs your react-native bundle.

A good example is if your launch activity is a splash screen which then sends the user to your MainActivity, which runs your react-native bundle. In this case you will need to send your splash activity's intent extras to your Main Activity's intent or react-native-notifications will not have access to the notification payload via the getInitialNotification function, so things like deep linking will not be possible.

Example:

 <activity
            android:name=".SplashActivity"
            android:theme="@style/SplashTheme"
            android:label="@string/app_name"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
                <action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
            </intent-filter>
        </activity>

onCreate of SplashActivity:

        Intent intent = new Intent(this, MainActivity.class);
        intent.putExtras(this.getIntent());
        startActivity(intent);
@oxilor
Copy link

oxilor commented Jul 1, 2024

@BTrottAtWork Thank you! I thought getInitialNotification does not work. Agree, it should be documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants