美文网首页
ANDROID集成腾讯信鸽推送教程(一)---------配置文

ANDROID集成腾讯信鸽推送教程(一)---------配置文

作者: 扯淡巴 | 来源:发表于2019-05-07 21:52 被阅读0次

ANDROID集成腾讯信鸽推送教程(一)---------配置文件设置

1、集成信鸽首先要在gradle文件中添加对应的依赖引用。

    implementation 'com.tencent.xinge:xinge:3.1.2-beta'
    implementation 'com.tencent.wup:wup:1.0.0.E-alpha'
    implementation 'com.tencent.mid:mid:3.9.0-alpha'

2、添加NDK的配置信息,主要是manifestPlaceholders的ID与Key的配置

defaultConfig {
        applicationId "*************"
        minSdkVersion 14
        targetSdkVersion 25
        versionCode 9
        versionName "1.0.9"
        multiDexEnabled true
        javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }

        ndk {
            //选择要添加的对应cpu类型的.so库。
            abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a','x86', 'x8664', 'mips', 'mips64'
            // 还可以添加 'x86', 'x8664', 'mips', 'mips64'
            manifestPlaceholders = [
                    XGACCESSID:"21003322222",
                    XGACCESSKEY:"A128DBRB15VL",
            ]
        }
    }

3、修改AndroidManifest.xml文件,此处需要进行两处修改。

一处是添加receiver,*号的地方修改为你的包名。

 <receiver android:name="******.MessageReceiver"
            android:exported="true" >
            <intent-filter>
                <!-- 接收消息透传 -->
                <action android:name="com.tencent.android.tpush.action.PUSH_MESSAGE" />
                <!-- 监听注册、反注册、设置/删除标签、通知被点击等处理结果 -->
                <action android:name="com.tencent.android.tpush.action.FEEDBACK" />
            </intent-filter>
        </receiver>

一处是当点击状态栏的消息后跳转到指定的Activity,使用scheme方式,官方推荐使用这种方式,主要是易于后台对页面参数的传值。

           <activity
            android:name="******.MessageDetailsActivity"
            android:hardwareAccelerated="false"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@style/AppTheme.NoActionBar">
            <!-- 协议部分,随便设置 -->
            <intent-filter>
                <!--协议部分,随便设置-->
                <data android:scheme="dfscheme" android:host="deepfar" android:path="/pushdetail" />
                <!--下面这几行也必须得设置-->
                <category android:name="android.intent.category.DEFAULT"/>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.BROWSABLE"/>
            </intent-filter>
        </activity>

到此对于信鸽的基础配置就到此完成,下一篇主要是开始在代码中进行注册token,同时对receiver中获取的数据处理问题等。

士心者,志在超越也!

相关文章

网友评论

      本文标题:ANDROID集成腾讯信鸽推送教程(一)---------配置文

      本文链接:https://www.haomeiwen.com/subject/twjuoqtx.html