移动应用开发服务端工具库 mobile-toolkit
本文导语: Java 的移动应用开发服务端工具库, 提供了Apple push,应用内支付校验, Amazon的aws的几个服务的调用. 在现在移动应用(ios,android)的开发过程中,经常会需要调用Apple 的push服务以及应用内支付校验的功能,现有的一些sdk使用起来都不...
Java 的移动应用开发服务端工具库, 提供了Apple push,应用内支付校验, Amazon的aws的几个服务的调用.
在现在移动应用(ios,android)的开发过程中,经常会需要调用Apple 的push服务以及应用内支付校验的功能,现有的一些sdk使用起来都不是很方便, 所以这里包装了一个更加简单更加方便的java库. 例如apple 的push服务其实就是包装了 APNS .
Amazon的S3存储和Mail功能在开发海外的项目中也是经常使用到的云服务,Amazon的SDK本身已经很全面,这里也仅仅是包装简化其使用方式.
Enjoy it!
## feature 1. APNS Apple push notification service
//setup apns by your keystore, key password and production ,false will use sandbox env ApnsTools apnsTools = new DefaultApnsTools("aps.p12", "password", false); apnsTools.alert("message", "device token"); //async apns , should set async thread number AsyncApnsTools asyncApnsTools = new DefaultAsyncApnsTools("aps.p12", "password", false, 12); asyncApnsTools.alert("message", "device token"); // you can setup a monitor for async apns tool.such as log monitor for print push result log. 2 is the log interval. TimeUnit is second AsyncNotificationMonitor monitor = new LogNotificationMonitor(2, asyncApnsTools);
Suggest config this in spring:
2. IAP Apple in app pay
//Setup iap tools, false will use sandbox env IapTools iapTools = new DefaultIapTools(false); IapReceipt receipt = iapTools.validate("your pay receipt"); System.out.print(receipt.getStatus());
Suggest config this in spring:
3. AWS S3 Amazon s3
AwsS3Tools s3Tools = new DefaultS3Tools("your accessKey", "your accessSecret"); String url = s3Tools.upload("bucket", "key", new byte[]{}, "image/png"); System.out.print(url);
Suggest config this in spring:
4. AWS Mail Amazon mail
AwsMailTools mailTools = new DefaultMailTools("your accessKey", "your accessSecret", "your admin mail");
mailTools.sendMail("to address", "title", "body");
Suggest config this in spring: