提交 e6b12f34 authored 作者: lgd's avatar lgd

1.添加极光推送

2.//todo  回款管理的客户接口
上级 f48b0bc8
......@@ -11,8 +11,10 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [
JPUSH_PKGNAME: applicationId,
JPUSH_APPKEY : "376831354e7055c58a957394", //JPush上注册的包名对应的appkey.
JPUSH_APPKEY : "1e9761959c929c9c0302f414", //JPush上注册的包名对应的appkey.376831354e7055c58a957394
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
]
}
buildTypes {
......@@ -108,4 +110,7 @@ dependencies {
implementation 'com.zhihu.android:matisse:0.5.2-beta3'
implementation 'cn.jzvd:jiaozivideoplayer:7.4.1'
implementation 'me.rosuh:AndroidFilePicker:0.6.2'
implementation 'cn.jiguang.sdk:jpush:3.3.4'
implementation 'cn.jiguang.sdk:jcore:2.1.2'
}
......@@ -19,7 +19,12 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="com.wd.workoffice.permission.JPUSH_MESSAGE" />
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<permission
android:name="com.wd.workoffice.permission.JPUSH_MESSAGE"
android:protectionLevel="signature" />
<application
android:name=".app.WorkApp"
android:allowBackup="true"
......@@ -2253,5 +2258,43 @@
<meta-data
android:name="design_width_in_dp"
android:value="375" />
<service android:name=".service.JPushService"
android:enabled="true"
android:exported="false"
android:process=":pushcore">
<intent-filter>
<action android:name="cn.jiguang.user.service.action" />
</intent-filter>
</service>
<!-- 该广播需要继承 JPush 提供的 JPushMessageReceiver 类, 并如下新增一个 Intent-Filter -->
<receiver
android:name=".service.JPushReceive"
android:enabled="true"
android:exported="false" >
<intent-filter>
<action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
<category android:name="com.wd.workoffice" />
</intent-filter>
</receiver>
<!--<provider-->
<!--android:authorities="com.wd.workoffice.DataProvider"-->
<!--android:name="cn.jpush.android.service.DataProvider"-->
<!--android:exported="true"-->
<!--/>-->
<!--<service-->
<!--android:name="cn.jpush.android.service.PushService"-->
<!--android:enabled="true"-->
<!--android:exported="false" >-->
<!--<intent-filter>-->
<!--<action android:name="cn.jpush.android.intent.REGISTER" />-->
<!--<action android:name="cn.jpush.android.intent.REPORT" />-->
<!--<action android:name="cn.jpush.android.intent.PushService" />-->
<!--<action android:name="cn.jpush.android.intent.PUSH_TIME" />-->
<!--</intent-filter>-->
<!--</service>-->
</application>
</manifest>
\ No newline at end of file
package com.wd.workoffice.service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import com.wd.workoffice.ui.activity.MainActivity;
import cn.jpush.android.api.JPushInterface;
/**
* 自定义接收器
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
* <p>
* 如果不定义这个 Receiver,则:
* * 1) 默认用户会打开主界面
* * 2) 接收不到自定义消息
**/
public class JPushReceive extends BroadcastReceiver {
private static final String TAG = "JIGUANG-Example";
@Override
public void onReceive(Context context, Intent intent) {
try {
Bundle bundle = intent.getExtras();
// Logger.d(TAG, "[MyReceiver] onReceive - " + intent.getAction() + ", extras: " + printBundle(bundle));
if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) {
String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID);
Log.d(TAG, "[MyReceiver] 接收Registration Id : " + regId);
//send the Registration Id to your server...
} else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) {
Log.d(TAG, "[MyReceiver] 接收到推送下来的自定义消息: " + bundle.getString(JPushInterface.EXTRA_MESSAGE));
// processCustomMessage(context, bundle);
} else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) {
Log.d(TAG, "[MyReceiver] 接收到推送下来的通知");
int notifactionId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID);
Log.d(TAG, "[MyReceiver] 接收到推送下来的通知的ID: " + notifactionId);
} else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) {
Log.d(TAG, "[MyReceiver] 用户点击打开了通知");
//打开自定义的Activity
Intent i = new Intent(context, MainActivity.class);
i.putExtras(bundle);
//i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP );
context.startActivity(i);
} else if (JPushInterface.ACTION_RICHPUSH_CALLBACK.equals(intent.getAction())) {
Log.d(TAG, "[MyReceiver] 用户收到到RICH PUSH CALLBACK: " + bundle.getString(JPushInterface.EXTRA_EXTRA));
//在这里根据 JPushInterface.EXTRA_EXTRA 的内容处理代码,比如打开新的Activity, 打开一个网页等..
} else if (JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction())) {
boolean connected = intent.getBooleanExtra(JPushInterface.EXTRA_CONNECTION_CHANGE, false);
Log.d(TAG, "[MyReceiver]" + intent.getAction() + " connected state change to " + connected);
} else {
Log.d(TAG, "[MyReceiver] Unhandled intent - " + intent.getAction());
}
} catch (Exception e) {
}
}
}
package com.wd.workoffice.service;
import cn.jpush.android.service.JCommonService;
public class JPushService extends JCommonService {
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论