极光消息推送(配置与初始化)

来源:互联网 发布:js删除注释工具 编辑:程序博客网 时间:2024/06/04 00:56
//清单文件xmlns:tools="http://schemas.android.com/tools"//appbuild
apply plugin: 'com.android.application'android {    compileSdkVersion 23    buildToolsVersion "23.0.3"    defaultConfig {        applicationId "com.example.administrator.jpushdemos"        minSdkVersion 15        targetSdkVersion 23        versionCode 1        versionName "1.0"        ndk {            //选择要添加的对应cpu类型的.so库。            abiFilters 'armeabi', 'armeabi-v7a', 'armeabi-v8a'            // 还可以添加 'x86', 'x86_64', 'mips', 'mips64'        }        manifestPlaceholders = [                JPUSH_PKGNAME : applicationId,                JPUSH_APPKEY : "0fdcdfd0e9e56443f9af596a", //JPush上注册的包名对应的appkey.                JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.        ]    }    buildTypes {        release {            minifyEnabled false            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'        }    }}dependencies {    compile fileTree(dir: 'libs', include: ['*.jar'])    testCompile 'junit:junit:4.12'    compile 'com.android.support:appcompat-v7:23.2.1'    compile 'cn.jiguang.sdk:jpush:3.0.3'  // 此处以JPush 3.0.3 版本为例。    compile 'cn.jiguang.sdk:jcore:1.1.1'  // 此处以JCore 1.1.1 版本为例。}//gradle.project 
android.useDeprecatedNdk=true//初始化
package com.example.administrator.jpushdemos;import android.os.Bundle;import android.support.v7.app.AppCompatActivity;import cn.jpush.android.api.JPushInterface;public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);        //初始化JPush        JPushInterface.init(this);        //设置debug模式        JPushInterface.setDebugMode(true);    }}



0 0
原创粉丝点击