Commit c84d837bb84ad5b59a37d5e09151ff5c51b5e3ae
1 parent
6a57d64f
Exists in
yxb_dev
and in
2 other branches
no message
Showing
4 changed files
with
154 additions
and
40 deletions
Show diff stats
.idea/modules.xml
... | ... | @@ -4,7 +4,8 @@ |
4 | 4 | <modules> |
5 | 5 | <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> |
6 | 6 | <module fileurl="file://$PROJECT_DIR$/mvpsdk/mvpsdk.iml" filepath="$PROJECT_DIR$/mvpsdk/mvpsdk.iml" /> |
7 | - <module fileurl="file://$PROJECT_DIR$/parentwork.iml" filepath="$PROJECT_DIR$/parentwork.iml" /> | |
7 | + <module fileurl="file://$PROJECT_DIR$/parentWorkHolper.iml" filepath="$PROJECT_DIR$/parentWorkHolper.iml" /> | |
8 | + <module fileurl="file://F:\parentWorkHolper\parentwork.iml" filepath="F:\parentWorkHolper\parentwork.iml" /> | |
8 | 9 | <module fileurl="file://$PROJECT_DIR$/roundedimageview-2.2.1/roundedimageview-2.2.1.iml" filepath="$PROJECT_DIR$/roundedimageview-2.2.1/roundedimageview-2.2.1.iml" /> |
9 | 10 | </modules> |
10 | 11 | </component> | ... | ... |
No preview for this file type
app/src/main/AndroidManifest.xml
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
3 | - package="com.shunzhi.parent"> | |
3 | + package="com.shunzhi.parent"> | |
4 | 4 | |
5 | 5 | <!-- 用于进行网络定位 --> |
6 | - <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | |
6 | + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> | |
7 | 7 | <!-- 用于访问GPS定位 --> |
8 | - <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | |
9 | - <uses-permission android:name="android.permission.GET_TASKS" /> | |
10 | - <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> | |
11 | - <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | |
8 | + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> | |
9 | + <uses-permission android:name="android.permission.GET_TASKS"/> | |
10 | + <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/> | |
11 | + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> | |
12 | 12 | <!-- Android 6.0版本可去除,用于选举信息(通道复用)的同步 --> |
13 | - <uses-permission android:name="android.permission.WRITE_SETTINGS" /> | |
13 | + <uses-permission android:name="android.permission.WRITE_SETTINGS"/> | |
14 | 14 | <!-- 进行网络访问和网络状态监控相关的权限声明 --> |
15 | - <uses-permission android:name="android.permission.INTERNET" /> | |
15 | + <uses-permission android:name="android.permission.INTERNET"/> | |
16 | 16 | <!-- 用于获取运营商信息,用于支持提供运营商信息相关的接口 --> |
17 | - <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | |
17 | + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> | |
18 | 18 | <!-- 用于访问wifi网络信息,wifi信息会用于进行网络定位 --> |
19 | - <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | |
19 | + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> | |
20 | 20 | <!-- 用于获取wifi的获取权限,wifi信息会用来进行网络定位 --> |
21 | - <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | |
21 | + <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/> | |
22 | 22 | <!-- 允许对sd卡进行读写操作 --> |
23 | - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | |
23 | + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> | |
24 | 24 | <!-- 用于申请调用A-GPS模块 --> |
25 | - <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> | |
25 | + <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/> | |
26 | 26 | <!-- 网络库使用,当网络操作时需要确保事务完成不被杀掉 --> |
27 | - <uses-permission android:name="android.permission.WAKE_LOCK" /> | |
27 | + <uses-permission android:name="android.permission.WAKE_LOCK"/> | |
28 | 28 | <!-- 用于读取手机硬件信息等,用于机型过滤 --> |
29 | - <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | |
29 | + <uses-permission android:name="android.permission.READ_PHONE_STATE"/> | |
30 | 30 | <!-- 选举使用,当应用有删除或者更新时需要重新选举,复用推送通道 --> |
31 | - <uses-permission android:name="android.permission.BROADCAST_PACKAGE_CHANGED" /> | |
32 | - <uses-permission android:name="android.permission.BROADCAST_PACKAGE_REPLACED" /> | |
33 | - <uses-permission android:name="android.permission.RESTART_PACKAGES" /> | |
31 | + <uses-permission android:name="android.permission.BROADCAST_PACKAGE_CHANGED"/> | |
32 | + <uses-permission android:name="android.permission.BROADCAST_PACKAGE_REPLACED"/> | |
33 | + <uses-permission android:name="android.permission.RESTART_PACKAGES"/> | |
34 | 34 | <!-- 补偿通道小米PUSH使用,不用可去除 --> |
35 | 35 | <!-- <uses-permission android:name="android.permission.GET_TASKS" /> --> |
36 | 36 | <!-- 补偿通道GCM使用,不使用可去除 --> |
37 | - <uses-permission android:name="android.permission.GET_ACCOUNTS" /> | |
37 | + <uses-permission android:name="android.permission.GET_ACCOUNTS"/> | |
38 | 38 | <!-- 允许监听启动完成事件 --> |
39 | - <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | |
39 | + <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> | |
40 | 40 | <!-- 允许访问震动器 --> |
41 | - <uses-permission android:name="android.permission.VIBRATE" /> | |
41 | + <uses-permission android:name="android.permission.VIBRATE"/> | |
42 | 42 | <!-- 允许task重排序 --> |
43 | - <uses-permission android:name="android.permission.REORDER_TASKS" /> | |
43 | + <uses-permission android:name="android.permission.REORDER_TASKS"/> | |
44 | 44 | <!-- 用于申请获取蓝牙信息进行室内定位 --> |
45 | - <uses-permission android:name="android.permission.BLUETOOTH" /> | |
46 | - <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> | |
45 | + <uses-permission android:name="android.permission.BLUETOOTH"/> | |
46 | + <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> | |
47 | + | |
48 | + <!-- 接收 SDK 消息广播权限, 第三方 APP 接入时,请将 com.netease.nim.demo 替换为自己的包名 --> | |
49 | + <uses-permission android:name="com.shunzhi.parent.permission.RECEIVE_MSG"/> | |
50 | + <uses-permission android:name="android.permission.CALL_PHONE"/> | |
47 | 51 | |
48 | 52 | <application |
49 | 53 | android:name=".AppContext" |
... | ... | @@ -55,58 +59,102 @@ |
55 | 59 | android:theme="@style/Theme.AppCompat.Light.NoActionBar"> |
56 | 60 | |
57 | 61 | <!-- 高德地图服务 --> |
58 | - <service android:name="com.amap.api.location.APSService" /> | |
62 | + <service android:name="com.amap.api.location.APSService"/> | |
59 | 63 | <!-- 高德地图密钥 --> |
60 | 64 | <!-- <meta-data --> |
61 | 65 | <!-- android:name="com.amap.api.v2.apikey" --> |
62 | 66 | <!-- android:value="0da7965006ae0c8e4106c76c1867d976"/> --> |
67 | + | |
68 | + <!--家长慧测试APPkey--> | |
69 | + <meta-data | |
70 | + android:name="com.netease.nim.appKey" | |
71 | + android:value="330158c080acdf4dc1092d6a74576c2c"/> | |
72 | + | |
73 | + <meta-data | |
74 | + android:name="android.max_aspect" | |
75 | + android:value="2.1"/> | |
76 | + | |
77 | + <!-- 声明云信后台服务 --> | |
78 | + <service | |
79 | + android:name="com.netease.nimlib.service.NimService" | |
80 | + android:process=":core"/> | |
81 | + | |
82 | + <!-- 运行后台辅助服务 --> | |
83 | + <service | |
84 | + android:name="com.netease.nimlib.service.NimService$Aux" | |
85 | + android:process=":core"/> | |
86 | + | |
87 | + <!-- 声明云信后台辅助服务 --> | |
88 | + <service | |
89 | + android:name="com.netease.nimlib.job.NIMJobService" | |
90 | + android:exported="true" | |
91 | + android:permission="android.permission.BIND_JOB_SERVICE" | |
92 | + android:process=":core"/> | |
93 | + | |
94 | + <!-- 云信SDK的监视系统启动和网络变化的广播接收器,用户开机自启动以及网络变化时候重新登录 --> | |
95 | + <receiver | |
96 | + android:name="com.netease.nimlib.service.NimReceiver" | |
97 | + android:exported="false" | |
98 | + android:process=":core"> | |
99 | + <intent-filter> | |
100 | + <action android:name="android.intent.action.BOOT_COMPLETED"/> | |
101 | + <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/> | |
102 | + </intent-filter> | |
103 | + </receiver> | |
104 | + | |
105 | + <!-- 云信进程间通信receiver --> | |
106 | + <receiver android:name="com.netease.nimlib.service.ResponseReceiver"/> | |
107 | + | |
108 | + <!-- 云信进程间通信service --> | |
109 | + <service android:name="com.netease.nimlib.service.ResponseService"/> | |
110 | + | |
63 | 111 | <meta-data |
64 | 112 | android:name="com.amap.api.v2.apikey" |
65 | - android:value="1d130afb822d8a1019e6592cbaf10bcc" /> | |
113 | + android:value="1d130afb822d8a1019e6592cbaf10bcc"/> | |
66 | 114 | |
67 | 115 | <activity android:name=".ui.activity.LoginAndRegistActivity"> |
68 | 116 | <intent-filter> |
69 | - <action android:name="android.intent.action.MAIN" /> | |
117 | + <action android:name="android.intent.action.MAIN"/> | |
70 | 118 | |
71 | - <category android:name="android.intent.category.LAUNCHER" /> | |
119 | + <category android:name="android.intent.category.LAUNCHER"/> | |
72 | 120 | </intent-filter> |
73 | 121 | </activity> |
74 | 122 | <activity |
75 | 123 | android:name=".ui.MainActivity" |
76 | 124 | android:screenOrientation="portrait" |
77 | - android:windowSoftInputMode="adjustPan|stateAlwaysHidden" /> | |
125 | + android:windowSoftInputMode="adjustPan|stateAlwaysHidden"/> | |
78 | 126 | <activity |
79 | 127 | android:name=".ui.activity.MyChildActivity" |
80 | - android:screenOrientation="portrait" /> | |
81 | - <activity android:name=".ui.activity.consult.ConsultOneLevelActivity" /> | |
128 | + android:screenOrientation="portrait"/> | |
129 | + <activity android:name=".ui.activity.consult.ConsultOneLevelActivity"/> | |
82 | 130 | <!-- <activity android:name=".ui.activity.LoginAndRegistActivity" /> --> |
83 | 131 | <activity |
84 | 132 | android:name=".ui.activity.StartActivity" |
85 | - android:screenOrientation="portrait" /> | |
133 | + android:screenOrientation="portrait"/> | |
86 | 134 | <activity |
87 | 135 | android:name=".ui.activity.binding.CreateChildInfoActivity" |
88 | 136 | android:screenOrientation="portrait" |
89 | - android:windowSoftInputMode="adjustPan|stateHidden" /> | |
137 | + android:windowSoftInputMode="adjustPan|stateHidden"/> | |
90 | 138 | <activity |
91 | 139 | android:name=".ui.activity.binding.SelectSchoolActivity" |
92 | 140 | android:screenOrientation="portrait" |
93 | - android:windowSoftInputMode="adjustPan|stateHidden" /> | |
141 | + android:windowSoftInputMode="adjustPan|stateHidden"/> | |
94 | 142 | <!-- <activity android:name=".ui.activity.LoginAndRegistActivity" --> |
95 | 143 | <!-- android:screenOrientation="portrait" --> |
96 | 144 | <!-- /> --> |
97 | 145 | <activity |
98 | 146 | android:name=".ui.activity.PersonInfoActivity" |
99 | 147 | android:screenOrientation="portrait" |
100 | - android:windowSoftInputMode="adjustPan|stateHidden" /> | |
148 | + android:windowSoftInputMode="adjustPan|stateHidden"/> | |
101 | 149 | <activity |
102 | 150 | android:name=".ui.activity.binding.CheckInfoActivity" |
103 | 151 | android:screenOrientation="portrait" |
104 | - android:windowSoftInputMode="adjustPan|stateHidden" /> | |
152 | + android:windowSoftInputMode="adjustPan|stateHidden"/> | |
105 | 153 | <activity |
106 | 154 | android:name=".ui.activity.binding.InviteCodeActivity" |
107 | - android:screenOrientation="portrait" /> | |
108 | - <activity android:name=".ui.activity.consult.ConsultTwoLevelActivity" /> | |
109 | - <activity android:name=".ui.activity.orderdetail.OrderDetailActivity"></activity> | |
155 | + android:screenOrientation="portrait"/> | |
156 | + <activity android:name=".ui.activity.consult.ConsultTwoLevelActivity"/> | |
157 | + <activity android:name=".ui.activity.orderdetail.OrderDetailActivity"/> | |
110 | 158 | </application> |
111 | 159 | |
112 | 160 | </manifest> |
113 | 161 | \ No newline at end of file | ... | ... |
app/src/main/java/com/shunzhi/parent/manager/MessageManager.java
0 → 100644
... | ... | @@ -0,0 +1,65 @@ |
1 | +package com.shunzhi.parent.manager; | |
2 | + | |
3 | +import com.netease.nimlib.sdk.NIMClient; | |
4 | +import com.netease.nimlib.sdk.Observer; | |
5 | +import com.netease.nimlib.sdk.auth.AuthService; | |
6 | +import com.netease.nimlib.sdk.auth.LoginInfo; | |
7 | +import com.netease.nimlib.sdk.msg.MsgServiceObserve; | |
8 | +import com.netease.nimlib.sdk.msg.model.CustomNotification; | |
9 | +import com.netease.nimlib.sdk.msg.model.IMMessage; | |
10 | + | |
11 | +import java.util.List; | |
12 | + | |
13 | +/** | |
14 | + * Created by 10501 on 2018/3/17. | |
15 | + */ | |
16 | + | |
17 | +public class MessageManager { | |
18 | + | |
19 | + private static class InstanceHolder { | |
20 | + static final MessageManager instance = new MessageManager(); | |
21 | + } | |
22 | + | |
23 | + public MessageManager getInstance() { | |
24 | + return InstanceHolder.instance; | |
25 | + } | |
26 | + | |
27 | + private Observer<List<IMMessage>> messageObserver = new Observer<List<IMMessage>>() { | |
28 | + @Override | |
29 | + public void onEvent(List<IMMessage> imMessages) { | |
30 | + onMessageReceive(imMessages); | |
31 | + } | |
32 | + }; | |
33 | + private Observer<CustomNotification> customNotificationObserver = new Observer<CustomNotification>() { | |
34 | + @Override | |
35 | + public void onEvent(CustomNotification customNotification) { | |
36 | + onCustomNotificationReceive(customNotification); | |
37 | + } | |
38 | + }; | |
39 | + | |
40 | + | |
41 | + private MessageManager() { | |
42 | + NIMClient.getService(MsgServiceObserve.class).observeReceiveMessage(messageObserver, true); | |
43 | + NIMClient.getService(MsgServiceObserve.class).observeCustomNotification(customNotificationObserver, true); | |
44 | + | |
45 | + } | |
46 | + | |
47 | + private void onMessageReceive(List<IMMessage> messageList) { | |
48 | + | |
49 | + } | |
50 | + | |
51 | + private void onCustomNotificationReceive(CustomNotification customnotification) { | |
52 | + | |
53 | + } | |
54 | + | |
55 | + public void login(String account, String password) { | |
56 | + NIMClient.getService(AuthService.class).login(new LoginInfo(account, password)); | |
57 | + } | |
58 | + | |
59 | + | |
60 | + public void logout() { | |
61 | + NIMClient.getService(MsgServiceObserve.class).observeReceiveMessage(messageObserver, false); | |
62 | + NIMClient.getService(MsgServiceObserve.class).observeCustomNotification(customNotificationObserver, false); | |
63 | + NIMClient.getService(AuthService.class).logout(); | |
64 | + } | |
65 | +} | ... | ... |