zoukankan      html  css  js  c++  java
  • 百度云推送

    在百度上 搜索百度云推送http://push.baidu.com/

    文档中心有个 3分钟快速入门 http://push.baidu.com/doc/guide/join

    点击下载SDK 立即下载

    点击创建应用 (注意包名) 创建完成 点击应用配置 有API KEY值

    剩下看文档中心http://push.baidu.com/doc/android/api

    注意 其中配置权限下面的放到MainActivity创建之下要不然会报设备为空

    <activity android:label="@string/app_name" android:name="com.bawei.jinritioutiao.MainActivity">
    <intent-filter>
    <action android:name="android.intent.action.MAIN"/>

    <category android:name="android.intent.category.LAUNCHER"/>
    </intent-filter>

    </activity>下

    <!-- push service start -->
    <!-- 用于接收系统消息以保证PushService正常运行 -->
    <receiver android:name="com.baidu.android.pushservice.PushServiceReceiver"
        android:process=":bdservice_v1" >
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
            <action android:name="com.baidu.android.pushservice.action.notification.SHOW" />
            <action android:name="com.baidu.android.pushservice.action.media.CLICK" />
            <!-- 以下四项为可选的action声明,可大大提高service存活率和消息到达速度 -->
            <action android:name="android.intent.action.MEDIA_MOUNTED" />
            <action android:name="android.intent.action.USER_PRESENT" />
            <action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
            <action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
        </intent-filter>
    </receiver>
    <!-- Push服务接收客户端发送的各种请求-->
    <receiver android:name="com.baidu.android.pushservice.RegistrationReceiver"
        android:process=":bdservice_v1" >
        <intent-filter>
            <action android:name="com.baidu.android.pushservice.action.METHOD" />
            <action android:name="com.baidu.android.pushservice.action.BIND_SYNC" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.PACKAGE_REMOVED" />
            <data android:scheme="package" />
        </intent-filter>                   
    </receiver>
    <service android:name="com.baidu.android.pushservice.PushService" android:exported="true" 
        android:process=":bdservice_v1" >
        <intent-filter >
                <action android:name="com.baidu.android.pushservice.action.PUSH_SERVICE" />
        </intent-filter>
    </service>
    <!-- 4.4版本新增的CommandService声明,提升小米和魅族手机上的实际推送到达率 -->
    <service android:name="com.baidu.android.pushservice.CommandService"
        android:exported="true" />
    <!-- push结束 -->
    
    <!-- 4.6版本新增的Activity声明,提升Push后台存活率 -->
    <activity
        android:launchMode="singleInstance"
        android:name="com.baidu.android.pushservice.PushKeepAlive"
        android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
  • 相关阅读:
    初学:利用mybatis-generator自动生成代码
    数组求和forEach方法
    Node.js热部署代码,实现修改代码后自动重启服务方便实时调试
    nodejs中文乱码问题
    简单说一下SS的原理
    Spring Cloud Eureka 3 (Eureka client注册服务提供者)
    Spring Cloud Eureka 2 (Eureka Server搭建服务注册中心)
    Spring Cloud Eureka 1(eureka简介)
    eclipse中创建多模块maven web项目
    eclipse中创建maven web项目
  • 原文地址:https://www.cnblogs.com/ldou/p/5320315.html
Copyright © 2011-2022 走看看