在我们Android的实际开发中,推送都与我们的工作息息相关。我们也曾遇见过因为项目一个一个需要去集成推送,非常费时,并且效果不是很好。主要是因为各个大厂文档整理不统一,并且也可能会有一下文档缺陷。所以在新项目开发的时候,特地整理一份push大全,供大家学习,如有缺陷,请指出…
项目地址:PushAll让你的项目集成更方便
大厂包含:
- 小米
- oppo
- vivo
- 华为
- 魅族
集成方式:
账号配置:
push_config.gradle
/*配置账号相关*/
main_packagename = "\"com.dongxl.push\""
pushreceiveservice = "\"com.dongxl.push.service.PushReceiveService\""
jpush_pkgname = "com.dongxl.push"
jpush_appkey = "46b514bd1b982739ec4d2f6f"
jpush_channel = "default_developer"
huaweipush_appid = "101001991"
vivopush_appkey = "101001991"
vivopush_appid = "101001991"
xiaomipush_appid = "\"2882303761517172047\""
xiaomipush_appkey = "\"5331717244047\""
oppopush_appid = "\"bt2M9eaEu4jZZoYqqYVT6e3X\""
oppopush_appkey = "\"bt2M9eaEu4jZZoYqqYVT6e3X\""
oppopush_appsecret = "\"bt2M9eaEu4jZZoYqqYVT6e3X\""
meizupush_appkey = "\"bt2M9eaEu4jZZoYqqYVT6e3X\""
meizupush_appid = "\"bt2M9eaEu4jZZoYqqYVT6e3X\""
Gradle
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.commonprogress:PushAll:Tag'
}
Maven
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.commonprogress</groupId>
<artifactId>PushAll</artifactId>
<version>Tag</version>
</dependency>
代码中需要实现的步骤:
PushRegisterSet 推送注册操作类
PushRegisterSet.applicationInit()初始化
PushRegisterSet.registerInitPush()注册
PushRegisterSet.registerInitPush()注册,可以放在application也可以放在app第一个界面中
PushReceiveService 推送注册结果就收类,还有推送事件到达类
欢迎学习交流

本文介绍了一款名为PushAll的工具,它能够简化Android应用中集成各大厂商推送服务的过程,包括小米、OPPO、vivo、华为和魅族等。通过统一的配置文件和简单的代码实现,开发者可以轻松完成推送服务的集成。
994

被折叠的 条评论
为什么被折叠?



