Created
April 8, 2021 11:48
-
-
Save kadiraydinli/79617cb1b49fa325262ee8ebff7afcb6 to your computer and use it in GitHub Desktop.
Java file for splash screen in project development with React Native.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.xxxxx; | |
| import android.content.Intent; | |
| import android.os.Bundle; | |
| import com.facebook.react.ReactActivity; | |
| public class SplashActivity extends ReactActivity { | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| try { | |
| Intent intent = new Intent(this, MainActivity.class); | |
| Bundle extras = getIntent().getExtras(); | |
| if (extras != null) { | |
| // this line is critical for Push Notifications to call | |
| // onNotificationOpenedApp | |
| intent.putExtras(extras); | |
| } | |
| intent.setAction(getIntent().getAction()); | |
| intent.setData(getIntent().getData()); | |
| startActivity(intent); | |
| finish(); | |
| } catch (Exception e) { | |
| e.printStackTrace(); | |
| finishAffinity(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment