mobile-toolkit - 移动应用开发服务端工具库


未知
跨平台
Java

软件简介

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:

    <bean id="apnsTools" class="mobi.app.toolkit.apple.impl.DefaultApnsTools">
            <constructor-arg index="0" value="${aps.key}"/>
            <constructor-arg index="1" value="${aps.password}"/>
            <constructor-arg index="2" value="${aps.production}"/>
    </bean>
    <bean id="asyncApnsTools" class="mobi.app.toolkit.apple.impl.DefaultAsyncApnsTools">
            <constructor-arg index="0" value="${aps.key}"/>
            <constructor-arg index="1" value="${aps.password}"/>
            <constructor-arg index="2" value="${aps.production}"/>
            <constructor-arg index="3" value="${aps.threadNumber}"/>
        </bean>
        <bean id="logMonitor" class="mobi.app.toolkit.apple.impl.LogNotificationMonitor">
            <constructor-arg index="0" value="2"/>
            <constructor-arg index="1" ref="asyncApnsTools"/>
        </bean>

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:

    <bean id="iapTools" class="mobi.app.toolkit.apple.impl.DefaultIapTools">
        <constructor-arg value="${iap.production}"/>
    </bean>

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:

  <bean id="amazonS3Client" class="mobi.app.toolkit.aws.impl.DefaultS3Tools">
        <constructor-arg index="0" value="${s3.accessKey}"/>
        <constructor-arg index="1" value="${s3.accessSecret}"/>
    </bean>

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:

 <bean id="awsMailTools" class="mobi.app.toolkit.aws.impl.DefaultMailTools">
        <constructor-arg index="0" value="${aws.accessKey}"/>
        <constructor-arg index="1" value="${aws.accessSecret}"/>
        <constructor-arg index="2" value="${aws.adminMail}"/>
    </bean>