ccj 2 سال پیش
والد
کامیت
834497c935
4فایلهای تغییر یافته به همراه50 افزوده شده و 44 حذف شده
  1. 35 34
      App.vue
  2. 15 10
      manifest.json
  3. BIN
      nativeplugins/DCloud-PushSound/android/res/raw/ring.mp3
  4. BIN
      nativeplugins/DCloud-PushSound/ios/pushsound.caf

+ 35 - 34
App.vue

@@ -157,47 +157,48 @@
 			gotoBackstageWhiteListAutStart() {
 				pushLive.gotoBackstage_WhiteList_autStart()
 			},
-			addLocation() {
-				let dst = setInterval(function() {
-					uni.request({
-						header: {
-							'Content-Type': 'application/x-www-form-urlencoded'
-						},
-						url: 'http://123.*******/location',
-						data: {
-							longitude: 114.1598,
-							latitude: 32.145380,
-							user_id: 1812
-						},
-						method: 'POST',
-						success: (res) => {
-							console.log(res)
-						}
-					})
-				}, 1000 * 60)
-			},
+			// addLocation() {
+			// 	let dst = setInterval(function() {
+			// 		uni.request({
+			// 			header: {
+			// 				'Content-Type': 'application/x-www-form-urlencoded'
+			// 			},
+			// 			url: 'http://123.*******/location',
+			// 			data: {
+			// 				longitude: 114.1598,
+			// 				latitude: 32.145380,
+			// 				user_id: 1812
+			// 			},
+			// 			method: 'POST',
+			// 			success: (res) => {
+			// 				console.log(res)
+			// 			}
+			// 		})
+			// 	}, 1000 * 60)
+			// },
 		},
 		onLaunch: function() {
 			// #ifdef APP-PLUS
 			let type = uni.getSystemInfoSync().platform
 			console.log(type)
 			if (type == "android") {
-				// const plugin = uni.requireNativePlugin("DCloud-PushSound");
-				// plugin.setCustomPushChannel({
-				// 	soundName: "pushsound",
-				// 	channelId: "task",
-				// 	channelDesc:"任务审核提醒",
-				// 	enableLights:true,
-				// 	enableVibration:true,
-				// 	importance:3,
-				// 	lockscreenVisibility:0
-				// });
-				// plugin.getAllChannels((p) => {
-				// 	console.log("channels :" + JSON.stringify(p));//返回数组
-					
-				// });
+				const plugin = uni.requireNativePlugin("DCloud-PushSound");
+				plugin.setCustomPushChannel({
+					soundName: "ring",
+					channelId: "task1",
+					channelDesc:"工作事项提醒",
+					enableLights:true,
+					enableVibration:true,
+					importance:3,
+					lockscreenVisibility:0
+				}); 
+				plugin.getAllChannels((p) => {
+					console.log("channels :" + JSON.stringify(p));//返回数组
+					// plugin.deleteChannel("taskNotice");
+					// plugin.deleteChannel("taskNew");
+				});
 				// plugin.testNotification({
-				// 	channelId: "task" //渠道id
+				// 	channelId: "task1" //渠道id
 				// });
 				//注意:开启服务之后,配置后台运行,白名单,自启动,即可实现长时间保活,黑屏传数据
 				this.goStartService();

+ 15 - 10
manifest.json

@@ -117,14 +117,19 @@
                 "permissions" : [
                     "<uses-feature android:name=\"android.hardware.camera\"/>",
                     "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
+                    "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
                     "<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
                     "<uses-permission android:name=\"android.permission.CAMERA\"/>",
                     "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
+                    "<uses-permission android:name=\"android.permission.FORCE_BACK\"/>",
+                    "<uses-permission android:name=\"android.permission.GET_TASKS\"/>",
                     "<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
                     "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.RECEIVE_BOOT_COMPLETED\"/>",
                     "<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
-                    "<uses-permission android:name=\"android.permission.INSTALL_PACKAGES\"/>  ",
-                    "<uses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\"/>"
+                    "<uses-permission android:name=\"android.permission.REORDER_TASKS\"/>",
+                    "<uses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\"/>",
+                    "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>"
                 ]
             },
             "icons" : {
@@ -233,15 +238,15 @@
             },
             "DCloud-PushSound" : {
                 "__plugin_info__" : {
-                    "name" : "自定义推送铃声和渠道",
-                    "description" : "自定义推送铃声同时支持 Android、iOS 平台",
+                    "name" : "DCloud-PushSound",
+                    "description" : "自定义推送铃声",
                     "platforms" : "Android,iOS",
-                    "url" : "https://ext.dcloud.net.cn/plugin?id=7482",
-                    "android_package_name" : "uni.UNI7297DA2",
-                    "ios_bundle_id" : "uni.UNI7297DA2",
-                    "isCloud" : true,
-                    "bought" : 1,
-                    "pid" : "7482",
+                    "url" : "",
+                    "android_package_name" : "",
+                    "ios_bundle_id" : "",
+                    "isCloud" : false,
+                    "bought" : -1,
+                    "pid" : "",
                     "parameters" : {}
                 }
             }

BIN
nativeplugins/DCloud-PushSound/android/res/raw/ring.mp3


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