android baidupush

简介:     实战 QQ demo源码(本例中有该应用) 服务器端下载:http://download.csdn.net/download/knight_black_bob/9822551 android eclipse 版:http://download.

 

 

实战 QQ demo源码(本例中有该应用)

服务器端下载http://download.csdn.net/download/knight_black_bob/9822551

android eclipse 版http://download.csdn.net/download/knight_black_bob/9822553

android stdio  版本http://download.csdn.net/download/knight_black_bob/9822556

 

 



 

 

 

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.courriousby.baidupush"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="18" />
    <!-- Push service 运行需要的权限 -->
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />  
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER"/>
    <uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
    <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.courriousby.baidupush.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        
        
        
        <receiver android:name="com.courriousby.baidupush.BaiduPushReciever">
            <intent-filter>
                <!-- 接收push消息 -->
                <action android:name="com.baidu.android.pushservice.action.MESSAGE" />
                <!-- 接收bind,unbind,fetch,delete等反馈消息 -->
                <action android:name="com.baidu.android.pushservice.action.RECEIVE" />
                <action android:name="com.baidu.android.pushservice.action.notification.CLICK" />
            </intent-filter>
        </receiver>
        <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 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>
        <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>
	   <service android:name="com.baidu.android.pushservice.CommandService"
            android:exported="true" />
        <activity
            android:launchMode="singleInstance"
            android:name="com.baidu.android.pushservice.PushKeepAlive"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />
        <meta-data android:name="api_key" android:value="GznlfC7K5jfSAHlZbtHfbfzz" />
    </application>

</manifest>

 

 

package com.courriousby.baidupush;

import java.util.List;

import android.content.Context;

import com.baidu.android.pushservice.PushMessageReceiver;

public class BaiduPushReciever extends PushMessageReceiver{

	@Override
	public void onBind(Context context, int errorCode, String appid,
            String userId, String channelId, String requestId)  {
		// TODO Auto-generated method stub
	}

	@Override
	public void onDelTags(Context context, int errorCode,
            List<String> sucessTags, List<String> failTags, String requestId) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onListTags(Context context, int errorCode, List<String> tags,
            String requestId) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onMessage(Context context, String message,
            String customContentString){
		 System.out.println(customContentString);
	}

	@Override
	public void onNotificationClicked(Context context, String title,
            String description, String customContentString) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void  onNotificationArrived(Context context, String title,
            String description, String customContentString)  {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onSetTags(Context context, int errorCode,
            List<String> sucessTags, List<String> failTags, String requestId) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onUnbind(Context context, int errorCode, String requestId) {
		// TODO Auto-generated method stub
		
	}

}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

捐助开发者

在兴趣的驱动下,写一个免费的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(右上角的爱心标志,支持支付宝和PayPal捐助),没钱捧个人场,谢谢各位。



 
 
 谢谢您的赞助,我会做的更好!

 

 

 

 

 

目录
相关文章
|
Shell 网络安全 开发工具
【错误记录】Android Studio 向 GitHub 提交代码报错 ( Push failed: Failed with error: Could not read from remote )
【错误记录】Android Studio 向 GitHub 提交代码报错 ( Push failed: Failed with error: Could not read from remote )
168 0
【错误记录】Android Studio 向 GitHub 提交代码报错 ( Push failed: Failed with error: Could not read from remote )
|
Android开发
【Android 逆向】x86 汇编 ( push / pop 入栈 / 出栈 指令 | ret / retn 函数调用返回指令 | set 设置目标值指令 )
【Android 逆向】x86 汇编 ( push / pop 入栈 / 出栈 指令 | ret / retn 函数调用返回指令 | set 设置目标值指令 )
283 0
|
JSON Devops Java
Android DevOps: From a Single Push Command to Production
DevOps refers to a set of well-known practices for automating software deliveries. By design, DevOps allows for easier maintenance and updating throug
2488 0
|
Android开发
android adb push 与 adb install的比较
<p><span style="font-size: 14pt;">Android 应用程序有两种安装方法:</span></p> <p><span style="font-size: 14pt;">1. 将应用程序的apk文件push到手机中,用如下命令:</span></p> <p><span style="font-size: 14pt;">   adb push xxxx.apk
1659 0
|
Android开发 Ubuntu Windows
Android adb “push pull”中文支持解决方案
Android adb “push pull”中文支持解决方案       在windows底下文件(夹)命名所采用的是GBK编码,而在Android中采用的UTF-8编码,所有使用adb 的push和pull命令时就会导致由于编码方式的不同而产生的错误,解决这一问题就只有对adb工具的源代码进行修改,让adb对文件名的编码进行相应的转换。
3066 0

相关产品

  • 云迁移中心