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"/>
  • 相关阅读:
    mysql压缩版安装
    网站还没加载完成时,显示正在加载的画面
    LESS基础教程
    用CSS编写多种常见的图形
    JavaScript的this
    JavaScript的闭包
    立即执行函数表达式(自执行函数)
    JavaScript的全局变量
    关于async function(){ let res = await } 详解
    mysql数据库的系统操作基本操作
  • 原文地址:https://www.cnblogs.com/ldou/p/5320315.html
Copyright © 2011-2022 走看看