Commit 75089115 by giaogiao

优化apns推送测试代码, apns 转base的代码

parent 7b13a0fe
...@@ -17,7 +17,7 @@ public class ApnsTest { ...@@ -17,7 +17,7 @@ public class ApnsTest {
public void test() throws Exception { public void test() throws Exception {
File file = new File("/Users/giaogiao/Downloads/push_zixun.p12"); File file = new File("/Users/giaogiao/Library/Containers/com.tencent.xinWeChat/Data/Library/Application Support/com.tencent.xinWeChat/2.0b4.0.9/f31cd9e6d7da1d15c57c40575f5c85db/Message/MessageTemp/e1180914825140f051a87348bda5cbb5/File/hipro_test_push.p12");
InputStream certificate = new FileInputStream(file); InputStream certificate = new FileInputStream(file);
String encode = Base64.encode(certificate); String encode = Base64.encode(certificate);
......
...@@ -6,6 +6,8 @@ import com.turo.pushy.apns.PushType; ...@@ -6,6 +6,8 @@ import com.turo.pushy.apns.PushType;
import com.wecloud.im.ws.sender.IosPush; import com.wecloud.im.ws.sender.IosPush;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.HashMap; import java.util.HashMap;
...@@ -29,17 +31,22 @@ public class IosApnsBase64Test { ...@@ -29,17 +31,22 @@ public class IosApnsBase64Test {
// * @param sound rtc= "call.caf"; 否则为default // * @param sound rtc= "call.caf"; 否则为default
Map<String, Object> customProperty = new HashMap<String, Object>(10); Map<String, Object> customProperty = new HashMap<String, Object>(10);
String apnsCertificatePath = "frogsell_push_dev.p12"; // String apnsCertificatePath = "frogsell_push_dev.p12";
String deviceToken = "27c93ca84bbf17d9ff8eb05df0576ac49822db2ae1c02aa0afea83b5c3861276"; String deviceToken = "5b761f954efe7493de0bc751942e1a8355853771b66a512f5687ca05e7335e99";
String alertTitle = "你好333"; String alertTitle = "你好333";
String alertBody = "hi333"; String alertBody = "hi333";
int badge = 1; int badge = 1;
String topicBundleId = "com.jdw.frogsell"; String topicBundleId = "com.xteng.Hibro";
boolean contentAvailable = false; boolean contentAvailable = false;
InputStream certificate = IosPush.getApnsCertificate(apnsCertificatePath); // InputStream certificate = IosPush.getApnsCertificate(apnsCertificatePath);
String encode = Base64.encode(certificate); // String encode = Base64.encode(certificate);
File file = new File("/Users/giaogiao/Library/Containers/com.tencent.xinWeChat/Data/Library/Application Support/com.tencent.xinWeChat/2.0b4.0.9/f31cd9e6d7da1d15c57c40575f5c85db/Message/MessageTemp/e1180914825140f051a87348bda5cbb5/File/hipro_test_push.p12");
InputStream in = new FileInputStream(file);
String encode = Base64.encode(in);
// 解码 // 解码
byte[] decode = Base64.decode(encode); byte[] decode = Base64.decode(encode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment