Java使用pushy(com.eatthepath)对接APns消息推送(基于HTTP/2协议)
需要IOS开发提供的信息
1.推送证书,.p8格式的文件
2.bundleId
3.keyId
4.teamId
MAVEN依赖
<dependency><groupId>com.eatthepath</groupId><artifactId>pushy</artifactId><version>0.15.0</version></dependency><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-simple</artifactId><version>1.7.21</version></dependency>
java代码
中间注释部分和后半部分一样都是获取推送的通知结果的,两种方式从实际需求考虑选择一种使用即可
import com.eatthepath.pushy.apns.ApnsClient;
import com.eatthepath.pushy.apns.ApnsClientBuilder;
import com.eatthepath.pushy.apns.PushNotificationResponse;
import com.eatthepath.pushy.apns.auth.ApnsSigningKey;
import com