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

Intent.extras is null when I open the app through notification press #226

Closed
nateshmbhat opened this issue Nov 5, 2021 · 6 comments
Closed
Labels
needs-feedback Waiting on response to questions Type: Stale

Comments

@nateshmbhat
Copy link
Contributor

we have a react native app with android and ios embedded in it (since we are slowly migrating from native code to react native).

Earlier i was using react push notification library which used to give me the notification data within intent extras when the splash activity opened.

Now we're using notifee, which requires me to use getInitialNotification on the react native side to get the notification data. But what i want is some way to get the notification data on android side itself when the splash activity opens.

Can you please help me here.

@mikehardy
Copy link
Contributor

Sounds like you may not be handling the intent extras in the splash screen ? I've seen this before in previously-popular libraries - perhaps this helps crazycodeboy/react-native-splash-screen#289 (comment)

@helenaford helenaford added the needs-feedback Waiting on response to questions label Nov 7, 2021
@nateshmbhat
Copy link
Contributor Author

nateshmbhat commented Nov 10, 2021

@mikehardy @helenaford no we aren't using any such external library to show splash screen. Actually the splash screen activity itself is the main launcher activity which goes to another home page activity after some time.

<activity
            android:name=".ui.splash.SplashActivity"
            android:screenOrientation="portrait"
            android:launchMode="singleTop"
            android:theme="@style/full_screen">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
....

@mikehardy
Copy link
Contributor

I'm afraid it's all guesswork without a https://stackoverflow.com/help/minimal-reproducible-example - not sure what we can do here

@nateshmbhat
Copy link
Contributor Author

nateshmbhat commented May 15, 2022

@mikehardy the notifee docs say that the launcher activity "must" be a ReactActivity. But our project is such that the launcher activity is just the normal AppCompatActivity. It has nothing to do with splash library of any react native stuff.

I tried using another new activity and specified this new activity in android's launchActivity property when setting the notification.

class NotificationStartupActivity : ReactActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        Timber.i("NotificationStartupActivity : intent data = ${intent.data} , intent extras = ${intent.extras}")
        //Launch my ORIGINAL SPLASH (launcher) activity here
        finish()
    }

    override fun getMainComponentName(): String? {
        return "ReactNative"
    }
}

The resulting log shows that :
NotificationStartupActivity : intent data = null , intent extras = null

Please help me understand why i'm not getting the intent data in my above activity and what can i do to get this data ?

@mikehardy
Copy link
Contributor

I'm afraid it's all guesswork without a https://stackoverflow.com/help/minimal-reproducible-example - not sure what we can do here

@github-actions
Copy link

github-actions bot commented Dec 6, 2022

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-feedback Waiting on response to questions Type: Stale
Projects
None yet
Development

No branches or pull requests

3 participants