Skip to content

Commit f7f5198

Browse files
author
詹强
committed
更新example
1 parent bc2b1bf commit f7f5198

File tree

3 files changed

+23
-24
lines changed

3 files changed

+23
-24
lines changed

example/android/app/src/main/AndroidManifest.xml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,25 @@
22
xmlns:tools="http://schemas.android.com/tools"
33
package="com.example">
44

5-
<uses-permission android:name="android.permission.INTERNET" />
6-
75
<application
8-
android:name=".MainApplication"
9-
android:label="@string/app_name"
10-
android:icon="@mipmap/ic_launcher"
11-
android:roundIcon="@mipmap/ic_launcher_round"
12-
android:allowBackup="false"
13-
android:theme="@style/AppTheme"
14-
tools:ignore="GoogleAppIndexingWarning">
15-
<activity
16-
android:name=".MainActivity"
6+
android:name=".MainApplication"
7+
android:allowBackup="false"
8+
android:icon="@mipmap/ic_launcher"
179
android:label="@string/app_name"
18-
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
19-
android:windowSoftInputMode="adjustResize">
20-
<intent-filter>
21-
<action android:name="android.intent.action.MAIN" />
22-
<category android:name="android.intent.category.LAUNCHER" />
23-
</intent-filter>
24-
</activity>
25-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
10+
android:roundIcon="@mipmap/ic_launcher_round"
11+
android:theme="@style/AppTheme"
12+
tools:ignore="GoogleAppIndexingWarning">
13+
<activity
14+
android:name=".MainActivity"
15+
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
16+
android:label="@string/app_name"
17+
android:windowSoftInputMode="adjustResize">
18+
<intent-filter>
19+
<action android:name="android.intent.action.MAIN" />
20+
<category android:name="android.intent.category.LAUNCHER" />
21+
</intent-filter>
22+
</activity>
23+
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
2624

2725
<meta-data
2826
android:name="JPUSH_CHANNEL"
@@ -33,4 +31,6 @@
3331

3432
</application>
3533

34+
<uses-permission android:name="android.permission.INTERNET" />
35+
3636
</manifest>

example/android/app/src/main/java/com/example/MainApplication.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
package com.example;
22

33
import android.app.Application;
4-
import android.util.Log;
54

65
import com.facebook.react.PackageList;
7-
import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
8-
import com.facebook.react.bridge.JavaScriptExecutorFactory;
96
import com.facebook.react.ReactApplication;
107
import com.facebook.react.ReactNativeHost;
118
import com.facebook.react.ReactPackage;
129
import com.facebook.soloader.SoLoader;
1310

1411
import java.util.List;
1512

16-
import cn.jiguang.plugins.push.JPushPackage;
13+
import cn.jiguang.plugins.push.JPushModule;
1714

1815
public class MainApplication extends Application implements ReactApplication {
1916

@@ -46,5 +43,7 @@ public ReactNativeHost getReactNativeHost() {
4643
public void onCreate() {
4744
super.onCreate();
4845
SoLoader.init(this, /* native exopackage */ false);
46+
//调用此方法:点击通知让应用从后台切到前台
47+
JPushModule.registerActivityLifecycle(this);
4948
}
5049
}

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"dependencies": {
1010
"jcore-react-native": "^1.3.7",
11-
"jpush-react-native": "^2.5.8",
11+
"jpush-react-native": "^2.5.9",
1212
"react": "16.8.6",
1313
"react-native": "0.60.5"
1414
},

0 commit comments

Comments
 (0)