Skip to content

Commit 00599ca

Browse files
committed
新增setAuth隐私合规接口
1 parent 3faac19 commit 00599ca

File tree

3 files changed

+25
-24
lines changed

3 files changed

+25
-24
lines changed

plugin.xml

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -85,33 +85,30 @@
8585

8686
<!-- Required 一些系统要求的权限,如访问网络等-->
8787
<uses-permission android:name="$PACKAGE_NAME.permission.JPUSH_MESSAGE" />
88-
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
8988
<uses-permission android:name="android.permission.INTERNET" />
9089
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
9190
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
9291
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
93-
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
9492
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
9593
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
96-
94+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
9795

9896

9997
<!-- Optional for location -->
10098
<uses-permission android:name="android.permission.VIBRATE" />
101-
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!-- 用于开启 debug 版本的应用在6.0 系统上 层叠窗口权限 -->
10299
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
103100
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
104101
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
105102
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /><!-- Android Q后台定位权限-->
106-
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
107103
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
108104
<uses-permission android:name="android.permission.GET_TASKS" />
109105
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
110-
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
111106
<!--华为角标-->
112107
<uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE"/>
113108
<!-- vivo 角标 -->
114109
<uses-permission android:name="com.vivo.notification.permission.BADGE_ICON" />
110+
<!--honor 角标-->
111+
<uses-permission android:name="com.hihonor.android.launcher.permission.CHANGE_BADGE" />
115112
</config-file>
116113

117114
<config-file target="AndroidManifest.xml" parent="/manifest/application" mode="merge">
@@ -136,7 +133,7 @@
136133
android:name="cn.jpush.android.ui.PushActivity"
137134
android:configChanges="orientation|keyboardHidden"
138135
android:theme="@android:style/Theme.NoTitleBar"
139-
android:exported="false">
136+
android:exported="true">
140137
<intent-filter>
141138
<action android:name="cn.jpush.android.ui.PushActivity" />
142139
<category android:name="android.intent.category.DEFAULT" />
@@ -230,7 +227,7 @@
230227
<activity
231228
android:name="cn.jpush.android.service.JNotifyActivity"
232229
android:exported="true"
233-
android:taskAffinity="jpush.custom"
230+
android:taskAffinity=""
234231
android:theme="@style/JPushTheme" >
235232
<intent-filter>
236233
<action android:name="cn.jpush.android.intent.JNotifyActivity" />
@@ -243,7 +240,7 @@
243240
<activity
244241
android:name="cn.android.service.JTransitActivity"
245242
android:exported="true"
246-
android:taskAffinity="jpush.custom"
243+
android:taskAffinity=""
247244
android:theme="@style/JPushTheme" >
248245
<intent-filter>
249246
<action android:name="cn.android.service.JTransitActivity" />
@@ -263,20 +260,6 @@
263260
<action android:name="cn.jiguang.user.service.action" />
264261
</intent-filter>
265262
</service>
266-
<!-- since 4.6.3 可选,适配Anroid7.0及以上,如果您的应用需要在Anroid7.0及以上环境运行 -->
267-
<provider
268-
android:name="cn.jiguang.union.ads.service.JAdFileProvider"
269-
android:authorities="$PACKAGE_NAME.JAdFileProvider"
270-
android:exported="false"
271-
android:grantUriPermissions="true" >
272-
<meta-data
273-
android:name="android.support.FILE_PROVIDER_PATHS"
274-
android:resource="@xml/jpush_file_paths" />
275-
<intent-filter>
276-
<action android:name="cn.jpush.android.intent.FileProvider" />
277-
<category android:name="$PACKAGE_NAME" />
278-
</intent-filter>
279-
</provider>
280263

281264
<receiver
282265
android:name="cn.jiguang.cordova.push.JPushReceiver"
@@ -299,7 +282,7 @@
299282

300283
</config-file>
301284

302-
<lib-file src="src/android/libs/jpush-android-4.8.1.jar" />
285+
<lib-file src="src/android/libs/jpush-android-4.8.5.jar" />
303286

304287
<source-file src="src/android/PushService.java" target-dir="src/cn/jiguang/cordova/push" />
305288
<source-file src="src/android/JPushPlugin.java" target-dir="src/cn/jiguang/cordova/push" />

src/android/JPushPlugin.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import cn.jpush.android.api.JPushInterface;
3232
import cn.jpush.android.api.TagAliasCallback;
3333
import cn.jpush.android.data.JPushLocalNotification;
34+
import cn.jiguang.api.utils.JCollectionAuth;
3435

3536
public class JPushPlugin extends CordovaPlugin {
3637

@@ -674,6 +675,17 @@ void setMobileNumber(JSONArray data, CallbackContext callbackContext) throws JSO
674675
JPushInterface.setMobileNumber(mContext,sequence, number);
675676
}
676677

678+
void setAuth(JSONArray data, CallbackContext callbackContext) {
679+
boolean isAuth = false;
680+
try {
681+
isAuth = data.getBoolean(0);
682+
JCollectionAuth.setAuth(mContext, isAuth);
683+
callbackContext.success();
684+
} catch (JSONException e) {
685+
e.printStackTrace();
686+
}
687+
}
688+
677689
private boolean isValidHour(int hour) {
678690
return !(hour < 0 || hour > 23);
679691
}

www/JPushPlugin.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,12 @@ JPushPlugin.prototype.setBadgeNumber = function(badgeNumb) {
482482
}
483483
};
484484

485+
JPushPlugin.prototype.setAuth = function(isAuth){
486+
if(device.platform === "Android"){
487+
this.callNative("setAuth", [isAuth], null);
488+
}
489+
}
490+
485491
/**
486492
* 设置手机号。
487493
*

0 commit comments

Comments
 (0)