lilei преди 2 години
родител
ревизия
a35a70d744

+ 5 - 3
App.vue

@@ -40,10 +40,11 @@
 				}
 				skJGPush.requestNotificationAuthorization((result)=>{
 					let status = result.status
+					console.log(result,'通知权限')
 					if (status < 2) {
 						uni.showModal({
 							title: '提示',
-							content: '您还没有打开通知权限',
+							content: '您未打开通知权限,应用将无法收到消息通知,确定开启通知权限吗?',
 							success: function (res) {
 								if (res.confirm) {
 									skJGPush.openSettingsForNotification()
@@ -75,13 +76,14 @@
 				if(result.notificationEventType == 'notificationOpened'){
 					this.setRead(result)
 				}else if(result.notificationEventType == 'notificationArrived'){
-					if(bgAudioManager){
+					// 安卓铃声
+					if(bgAudioManager&&uni.getSystemInfoSync().platform != "ios"){
 						bgAudioManager.src = '/static/notes.mp3';
 						bgAudioManager.play()
 					}
 				}else{
 					// 清空角标
-					skJGPush.setBadge(1)
+					skJGPush.setBadge(0)
 				}
 			})
 			

+ 16 - 0
manifest.json

@@ -100,6 +100,8 @@
                     "NSPhotoLibraryAddUsageDescription" : "扫描识别产品需要访问设备相册,是否同意?", //可选,字符串类型,系统相册写入权限描述
                     "NSCameraUsageDescription" : "扫描识别产品二维码需要访问相机,是否同意?", //可选,字符串类型,摄像头使用权限描述
                     "NSLocationWhenInUseUsageDescription" : "连接打印机需要开启位置权限,是否同意?", //可选,字符串类型,运行期访问位置权限描述
+					"NSLocationAlwaysUsageDescription": "连接打印机需要开启位置权限,是否同意?",  //可选,字符串类型,后台运行访问位置权限描述
+					"NSLocationAlwaysAndWhenInUseUsageDescription": "连接打印机需要开启位置权限,是否同意?", //可选,字符串类型,运行期后后台访问位置权限描述
                     "NSBluetoothPeripheralUsageDescription" : "连接打印机需要开启蓝牙权限,是否同意?", //可选,字符串类型,使用蓝牙权限描述
                     "NSBluetoothAlwaysUsageDescription" : "连接打印机需要开启蓝牙权限,是否同意?" //可选,字符串类型,后台使用蓝牙权限描述
                 }
@@ -298,6 +300,20 @@
                         }
                     }
                 }
+            },
+            "DCloud-PushSound" : {
+                "__plugin_info__" : {
+                    "name" : "自定义推送铃声和渠道",
+                    "description" : "自定义推送铃声同时支持 Android、iOS 平台",
+                    "platforms" : "Android,iOS",
+                    "url" : "https://ext.dcloud.net.cn/plugin?id=7482",
+                    "android_package_name" : "com.iscm.arrow360",
+                    "ios_bundle_id" : "com.iscm.arrow360",
+                    "isCloud" : true,
+                    "bought" : 1,
+                    "pid" : "7482",
+                    "parameters" : {}
+                }
             }
         }
     },

BIN
nativePlugins/DCloud-PushSound/android/res/raw/pushsound.mp3


BIN
nativePlugins/DCloud-PushSound/android/uniplugin_custom_push_channel-release.aar


BIN
nativePlugins/DCloud-PushSound/ios/pushsound.caf


+ 36 - 0
nativePlugins/DCloud-PushSound/package.json

@@ -0,0 +1,36 @@
+{
+	"name": "DCloud-PushSound",
+	"id": "DCloud-PushSound",
+	"version": "1.0.1",
+	"description": "自定义推送铃声",
+	"_dp_type": "nativeplugin",
+	"_dp_nativeplugin": {
+		"ios": {
+			"plugins": [{
+				"type": "module",
+				"name": "DCloud-PushSound",
+				"class": "DCPushSound"
+			}],
+			"deploymentTarget": "9.0",
+			"integrateType": "library",
+			"resources": [
+				"pushsound.caf"
+			]
+		},
+		"android": {
+		    "plugins": [
+		        {
+		            "type": "module",
+		            "name": "DCloud-PushSound",
+		            "class": "io.dcloud.uniplugin.custom_push_channel.CustomNotificationChannel"
+		        }
+		    ],
+		    "integrateType": "aar",
+		    "compileOptions": {
+		        "sourceCompatibility": "1.8",
+		        "targetCompatibility": "1.8"
+		    },
+		    "minSdkVersion": "19"
+		}
+	}
+}