今天主要写了一个小demo来集成极光推送的功能到项目

第一步,先看proj_gradle配置:

buildscript {repositories {jcenter()}dependencies {classpath 'com.android.tools.build:gradle:2.2.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        //添加内容
//        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
    }
}// this script was used to upload files to bintray.
//apply from: 'bintray.gradle'

allprojects {repositories {jcenter()}
}task clean(type: Delete) {delete rootProject.buildDir
}

主要添加

    // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        //添加内容
//        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
// Top-level build file where you can add configuration options common to all sub-projects/modules.

2.再看app.gradle配置

android {compileSdkVersion 23
    buildToolsVersion "24.0.2"
    defaultConfig {applicationId "com.example.maguitao.demo"
        minSdkVersion 21
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        ndk {//选择要添加的对应cpu类型的.so库
            abiFilters 'armeabi', 'armeabi-v7a', 'armeabi-v8a'
            //还可以添加 'armeabi-v7a', 'x86'
        }manifestPlaceholders = [JPUSH_PKGNAME : "com.example.maguitao.demo",//包名字JPUSH_APPKEY : "9389b8bad8346cece74fb112", //JPush上注册的包名对应的appkey.
                JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.
        ]}
}
添加依赖
compile 'cn.jiguang.sdk:jpush:3.0.0'  // 此处以JPush 3.0.0 版本为例。
compile 'cn.jiguang.sdk:jcore:1.0.0'  // 此处以JCore 1.0.0 版本为例。
,最后就是清单文件的配置了:
<!-- 以下是极光推送的配置-->
      <!-- Required SDK 核心功能-->
      <!-- 可配置android:process参数将PushService放在其他进程中 -->
      <service
          android:name="cn.jpush.android.service.PushService"
          android:enabled="true"
          android:exported="false" ><intent-filter><action android:name="cn.jpush.android.intent.REGISTER" /><action android:name="cn.jpush.android.intent.REPORT" /><action android:name="cn.jpush.android.intent.PushService" /><action android:name="cn.jpush.android.intent.PUSH_TIME" /></intent-filter></service><!-- since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 -->
      <!-- 若不启用该功能可删除该组件,将不拉起其他应用也不能被其他应用拉起 -->
      <service
          android:name="cn.jpush.android.service.DaemonService"
          android:enabled="true"
          android:exported="true"><intent-filter ><action android:name="cn.jpush.android.intent.DaemonService" /><category android:name="com.example.maguitao.demo"/></intent-filter></service><!-- Required SDK核心功能-->
      <receiver
          android:name="cn.jpush.android.service.PushReceiver"
          android:enabled="true" ><intent-filter android:priority="1000"><action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" /><category android:name="com.example.maguitao.demo"/></intent-filter><intent-filter><action android:name="android.intent.action.USER_PRESENT" /><action android:name="android.net.conn.CONNECTIVITY_CHANGE" /></intent-filter><!-- Optional -->
          <intent-filter><action android:name="android.intent.action.PACKAGE_ADDED" /><action android:name="android.intent.action.PACKAGE_REMOVED" /><data android:scheme="package" /></intent-filter></receiver><!-- Required SDK核心功能-->
      <activity
          android:name="cn.jpush.android.ui.PushActivity"
          android:configChanges="orientation|keyboardHidden"
          android:theme="@android:style/Theme.NoTitleBar"
          android:exported="false" ><intent-filter><action android:name="cn.jpush.android.ui.PushActivity" /><category android:name="android.intent.category.DEFAULT" /><category android:name="com.example.maguitao.demo" /></intent-filter></activity><!-- Required SDK核心功能-->
      <service
          android:name="cn.jpush.android.service.DownloadService"
          android:enabled="true"
          android:exported="false" ></service><!-- Required SDK核心功能-->
      <receiver android:name="cn.jpush.android.service.AlarmReceiver" /><!-- User defined.  For test only  用户自定义的广播接收器-->
      <receiver
          android:name="brodcast.MyReceiver"
          android:exported="false"
          android:enabled="true"><intent-filter><action android:name="cn.jpush.android.intent.REGISTRATION" /> <!--Required  用户注册SDK的intent-->
              <action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" /> <!--Required  用户接收SDK消息的intent-->
              <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" /> <!--Required  用户接收SDK通知栏信息的intent-->
              <action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" /> <!--Required  用户打开自定义通知栏的intent-->
              <action android:name="cn.jpush.android.intent.CONNECTION" /><!-- 接收网络变化 连接/断开 since 1.6.3 -->
              <category android:name="com.example.maguitao.demo" /></intent-filter></receiver><!-- Required. For publish channel feature -->
      <!-- JPUSH_CHANNEL 是为了方便开发者统计APK分发渠道。-->
      <!-- 例如: -->
      <!-- 发到 Google Play 的APK可以设置为 google-play; -->
      <!-- 发到其他市场的 APK 可以设置为 xxx-market。 -->
      <!-- 目前这个渠道统计功能的报表还未开放。-->
      <meta-data android:name="JPUSH_CHANNEL" android:value="developer-default"/><!-- Required. AppKey copied from Portal -->
      <meta-data android:name="JPUSH_APPKEY" android:value="9389b8bad8346cece74fb112"/>
<!--      极光推送配置完成-->

,,然后就是java代码里面自己初始化
private void initJiguang() {JPushInterface.setDebugMode(true);JPushInterface.init(this);
}
到此完成demo的下载地址在我个人分享里面:极光推送和环信智能机器人.ZIP

vmei-day04-Jcenter方式集成极光推送相关推荐

  1. Android第三方SDK集成 —— 极光推送

    前言: 本文前篇,可以帮助朋友们快速集成极光推送.本文后篇,是我自己项目实践的一些总结和心得,应该对读者们还是很有参考价值的,相信读完这篇文章,你会对极光推送有更加深入的理解,而不仅仅只是会集成而已. ...

  2. 三分钟帮你集成极光推送——和那些可能你不知道的事

    本文简介:本文前篇,可以帮助朋友们快速集成极光推送.本文后篇,是我自己项目实践的一些总结和心得,应该对读者们还是很有参考价值的,相信读完这篇文章,你会对极光推送有更加深入的理解,而不仅仅只是会集成而已 ...

  3. flutter应用开发中集成极光推送(flutter极光推送第一篇)

    题记 -- 执剑天涯,从你的点滴积累开始,所及之处,必精益求精,即是折腾每一天. 重要消息 精通点的可以查看这里 精述 Flutter 从入门实践到开发一个APP之UI基础篇 视频 flutter从入 ...

  4. Java中集成极光推送实现给Android提送消息通知(附代码下载)

    场景 Android中集成极光推送实现推送消息通知与根据别名指定推送附示例代码下载: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details ...

  5. php集成极光推送,thinkphp 写APP接口集成极光推送的例子

    下面我们来看一篇关于thinkphp 写APP接口集成极光推送,对于app的数据都得通过接口来实现了,当然也有内置数据库的不过这种非常少了. 最近用Thinkphp写了个App接口用到第三方推送功能, ...

  6. React-Native集成极光推送(Android和IOS)

    React-Native集成极光推送的具体流程如下: 本文选取的是极光官方维护的react-native推送插件,github地址:https://github.com/jpush/jpush-rea ...

  7. Android集成极光推送踩坑(二)升级篇

    转载请标明出处 http://blog.csdn.net/mohan6/article/details/74133186 本文作者:[默寒的博客] 前言 前段时间针对集成极光推送写了篇文章( Andr ...

  8. Android集成极光推送和踩过的坑(一)

    转载请标明出处 http://blog.csdn.net/mohan6/article/details/72960346 本文作者:[默寒的博客] 集成步骤以及集成过程遇到的坑: 这部分主要阐述了集成 ...

  9. ionic2集成极光推送

    ionic2集成极光推送: ionic2api:https://ionicframework.com/docs/ 极光推送官网:https://www.jiguang.cn android-怎么注册极 ...

最新文章

  1. 组策略管理——软件限制策略(4)
  2. 【转载】javascript下ie7,ie8的Date Bug的解决
  3. 撸完这些JVM知识点,明天就去面试阿里P6+
  4. 2的负x次幂图像_数学| NO.2,3函数 T51
  5. 中国冷凝管行业市场供需与战略研究报告
  6. CSS滤镜(filter)
  7. 国产操作系统(Linux)技术流派
  8. 医学知识-骨密度以及骨密度测量
  9. 使用GPG加密通讯,设置git提交验证密钥
  10. Windows XP下如何清理日志文件
  11. 整合flink-cdc实现实时读postgrasql
  12. C语言图书管理系统验证码,C语言的图书管理系统
  13. 《疯狂Java讲义》读书笔记5
  14. 2020-12-03_EditPlus下载安装注册
  15. unity3d插入android有米广告
  16. 已解决:Java环境变量配置后不生效
  17. 什么是 信息系统工程监理
  18. 【元宇宙】巧用大白话说清元宇宙
  19. angular 点菜_网页版餐厅点餐系统(五)
  20. 5G网关在智慧城管解决方案中的应用

热门文章

  1. Java燕山大学_GitHub - jiajiayao/YsuSelfStudy: 燕山大学空教室查询及教务辅助系统,中国大学生计算机设计大赛省赛三等奖,已上架小米应用商店...
  2. FBI 网站被黑,黑客获取 100 万条联邦特工身份信息
  3. Netty解析JT808协议
  4. 05-用户和组以及权限
  5. 大数据技术有哪些应该重点学哪些知识
  6. 【瞎逛】音乐碎碎笔记 01
  7. 2022华东杯A题核酸检测问题思路讲解
  8. python数据分析就业班_云开见明 2020Python数据分析师特训营全套课程84节
  9. 网上计算机能力提升研修心得,信息技术应用能力提升个人研修总结
  10. 弘辽科技:如何快速提升抖音小店