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"/>
  • 相关阅读:
    Java-注解(@Annotation)
    面试(三)---volatile
    面试(二)---synchronized
    Linux使用技巧(一):vim中选中多行、复制和粘贴
    Git——学习Git
    【Linux】Linux下cp ~中关于“~”的疑问
    【Linux】Linux中cd test和cd /test以及类似命令的区别
    【Linux】Linux系统中/opt 和 /usr目录
    【Linux】Linux的文件权限
    读《大数据时代下半场-数据治理、驱动与变现》--1
  • 原文地址:https://www.cnblogs.com/ldou/p/5320315.html
Copyright © 2011-2022 走看看