File tree Expand file tree Collapse file tree 1 file changed +25
-6
lines changed
Expand file tree Collapse file tree 1 file changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -19,29 +19,48 @@ This document is a guidance for how to use jpush-react-native in Android.
1919> app/MainApplication.java
2020
2121```
22- import cn.jpush.reactnativejpush.JPushPackage;
22+ import cn.jpush.reactnativejpush.JPushPackage; // <-- 导入 JPushPackage
2323
24- // 设置为 true 将不弹出 toast
24+ public class MainApplication extends Application implements ReactApplication {
25+
26+ // 设置为 true 将不会弹出 toast
2527 private boolean SHUTDOWN_TOAST = false;
26- // 设置为 true 将不打印 log
28+ // 设置为 true 将不会打印 log
2729 private boolean SHUTDOWN_LOG = false;
2830
2931 private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
3032
3133 @Override
32- protected boolean getUseDeveloperSupport() {
34+ public boolean getUseDeveloperSupport() {
3335 return BuildConfig.DEBUG;
3436 }
3537
38+ @Override
39+ protected String getJSMainModuleName() { // rn 0.49 后修改入口为 index
40+ return "index";
41+ }
3642
3743 @Override
3844 protected List<ReactPackage> getPackages() {
3945 return Arrays.<ReactPackage>asList(
4046 new MainReactPackage(),
41- new JPushPackage(SHUTDOWN_TOAST, SHUTDOWN_LOG)
42- );
47+ new JPushPackage(SHUTDOWN_TOAST, SHUTDOWN_LOG) // <-- 添加 JPushPackage
48+ );
4349 }
4450 };
51+
52+ @Override
53+ public ReactNativeHost getReactNativeHost() {
54+ return mReactNativeHost;
55+ }
56+
57+ @Override
58+ public void onCreate() {
59+ super.onCreate();
60+ SoLoader.init(this, /* native exopackage */ false);
61+ }
62+ }
63+
4564```
4665
4766### import JPushModule
You can’t perform that action at this time.
0 commit comments