Skip to content

Commit c86a59c

Browse files
authored
Update Android Usage.md
1 parent 336784e commit c86a59c

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

example/documents/Android Usage.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,48 @@ This document is a guidance for how to use jpush-react-native in Android.
2020
> app/MainApplication.java
2121
2222
```
23-
   // 设置为 true 将不弹出 toast
23+
import cn.jpush.reactnativejpush.JPushPackage;   // <--   导入 JPushPackage
24+
25+
public class MainApplication extends Application implements ReactApplication {
26+
27+
   // 设置为 true 将不会弹出 toast
2428
   private boolean SHUTDOWN_TOAST = false;
25-
   // 设置为 true 将不打印 log
29+
   // 设置为 true 将不会打印 log
2630
   private boolean SHUTDOWN_LOG = false;
2731
2832
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
2933
3034
@Override
31-
protected boolean getUseDeveloperSupport() {
35+
public boolean getUseDeveloperSupport() {
3236
return BuildConfig.DEBUG;
3337
}
3438
39+
@Override
40+
       protected String getJSMainModuleName() {         // rn 0.49 后修改入口为 index
41+
           return "index";
42+
}
3543
3644
@Override
3745
protected List<ReactPackage> getPackages() {
3846
return Arrays.<ReactPackage>asList(
3947
new MainReactPackage(),
40-
new JPushPackage(SHUTDOWN_TOAST, SHUTDOWN_LOG)
41-
);
48+
                   new JPushPackage(SHUTDOWN_TOAST, SHUTDOWN_LOG)   // <-- 添加 JPushPackage
49+
            );
4250
}
4351
};
52+
53+
@Override
54+
public ReactNativeHost getReactNativeHost() {
55+
return mReactNativeHost;
56+
}
57+
58+
@Override
59+
public void onCreate() {
60+
super.onCreate();
61+
SoLoader.init(this, /* native exopackage */ false);
62+
}
63+
}
64+
4465
```
4566

4667
### import JPushModule

0 commit comments

Comments
 (0)