|
@@ -15,7 +15,6 @@ import org.springframework.core.io.ClassPathResource;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import com.google.auth.oauth2.GoogleCredentials;
|
|
|
-import com.google.firebase.ErrorCode;
|
|
|
import com.google.firebase.FirebaseApp;
|
|
|
import com.google.firebase.FirebaseOptions;
|
|
|
import com.google.firebase.messaging.AndroidConfig;
|
|
@@ -27,8 +26,6 @@ import com.google.firebase.messaging.AndroidNotification.Priority;
|
|
|
import com.google.firebase.messaging.FirebaseMessaging;
|
|
|
import com.google.firebase.messaging.FirebaseMessagingException;
|
|
|
import com.google.firebase.messaging.Message;
|
|
|
-import com.notnoop.apns.APNS;
|
|
|
-import com.notnoop.apns.ApnsService;
|
|
|
|
|
|
@Component
|
|
|
public class PushUtils {
|
|
@@ -174,39 +171,39 @@ public class PushUtils {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- public void apnsSend() {
|
|
|
- ClassPathResource cpr = new ClassPathResource("apns/dev/certify.p12");
|
|
|
- logger.error("name -- > " + cpr.getFilename());
|
|
|
- logger.error("path -- > " + cpr.getPath());
|
|
|
- try {
|
|
|
- logger.error("file -- > " + cpr.getFile().getAbsolutePath());
|
|
|
-
|
|
|
- ApnsService service =
|
|
|
- APNS.newService()
|
|
|
- .withCert(cpr.getFile().getAbsolutePath(), "jksong092") // 指定p12文件及密钥
|
|
|
- .withSandboxDestination() // 使用苹果推送测试服务器
|
|
|
- //.withProductionDestination() // 使用苹果推送生产服务器
|
|
|
- .build();
|
|
|
-
|
|
|
- String payload = APNS.newPayload()
|
|
|
-// .alertTitle("推送标题") // 标题
|
|
|
- .alertBody("푸시발송 테스트") // 内容
|
|
|
- .customField("sourceCode", "01") // 自定义字段
|
|
|
- .customField("url", "https://www.qq.com") // 自定义字段
|
|
|
- .sound("default") // 提示声音
|
|
|
- //.sound("msgsound.caf") // 提示声音(自定义)
|
|
|
- .badge(1) // 应用角标
|
|
|
- .build();
|
|
|
-
|
|
|
- String token = "1EDAE24F474C7CB5497AD92BB92C506033218BF37E7C808C8CD3B28154D41B07";
|
|
|
-
|
|
|
- service.push(token, payload);
|
|
|
-
|
|
|
- } catch (IOException e) {
|
|
|
- // TODO Auto-generated catch block
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+// public void apnsSend() {
|
|
|
+// ClassPathResource cpr = new ClassPathResource("apns/dev/certify.p12");
|
|
|
+// logger.error("name -- > " + cpr.getFilename());
|
|
|
+// logger.error("path -- > " + cpr.getPath());
|
|
|
+// try {
|
|
|
+// logger.error("file -- > " + cpr.getFile().getAbsolutePath());
|
|
|
+//
|
|
|
+// ApnsService service =
|
|
|
+// APNS.newService()
|
|
|
+// .withCert(cpr.getFile().getAbsolutePath(), "jksong092") // 指定p12文件及密钥
|
|
|
+// .withSandboxDestination() // 使用苹果推送测试服务器
|
|
|
+// //.withProductionDestination() // 使用苹果推送生产服务器
|
|
|
+// .build();
|
|
|
+//
|
|
|
+// String payload = APNS.newPayload()
|
|
|
+//// .alertTitle("推送标题") // 标题
|
|
|
+// .alertBody("푸시발송 테스트") // 内容
|
|
|
+// .customField("sourceCode", "01") // 自定义字段
|
|
|
+// .customField("url", "https://www.qq.com") // 自定义字段
|
|
|
+// .sound("default") // 提示声音
|
|
|
+// //.sound("msgsound.caf") // 提示声音(自定义)
|
|
|
+// .badge(1) // 应用角标
|
|
|
+// .build();
|
|
|
+//
|
|
|
+// String token = "1EDAE24F474C7CB5497AD92BB92C506033218BF37E7C808C8CD3B28154D41B07";
|
|
|
+//
|
|
|
+// service.push(token, payload);
|
|
|
+//
|
|
|
+// } catch (IOException e) {
|
|
|
+// // TODO Auto-generated catch block
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
|
|
|
}
|