Created
September 19, 2020 18:24
-
-
Save 0x1bitcrack3r/9d9059ba00c98484a76dfd36ae06f6e7 to your computer and use it in GitHub Desktop.
This file contains 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
public class MainApplication extends NavigationApplication { | |
@Override | |
public boolean isDebug() { | |
// Make sure you are using BuildConfig from your own application | |
return BuildConfig.DEBUG; | |
} | |
protected List<ReactPackage> getPackages() { | |
// Add additional packages you require here | |
// No need to add RnnPackage and MainReactPackage | |
return Arrays.<ReactPackage>asList( | |
//new MainReactPackage() | |
//your react package here | |
); | |
} | |
@Override | |
public List<ReactPackage> createAdditionalReactPackages() { | |
return getPackages(); | |
} | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() { | |
@Override | |
public void onActivityCreated(Activity activity, Bundle savedInstanceState) { | |
} | |
@Override | |
public void onActivityStarted(Activity activity) { | |
if (activity instanceof NavigationActivity) { | |
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | |
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); | |
} | |
} | |
@Override | |
public void onActivityResumed(Activity activity) { | |
if (activity instanceof NavigationActivity && NavigationApplication.instance.getReactGateway().isInitialized()) { | |
Intent i = new Intent(activity, IncomingCallScreenActivity.class); | |
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); | |
startActivity(i); | |
} | |
} | |
@Override | |
public void onActivityPaused(Activity activity) { | |
} | |
@Override | |
public void onActivityStopped(Activity activity) { | |
} | |
@Override | |
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) { | |
} | |
@Override | |
public void onActivityDestroyed(Activity activity) { | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment