Skip to content
项目
Groups
代码片段
帮助
正在加载...
Sign in / Register
Toggle navigation
W
workoffice
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图表
统计图
Create a new issue
作业
提交
议题看板
Open sidebar
冷广德
workoffice
Commits
e6b12f34
提交
e6b12f34
authored
6月 17, 2020
作者:
lgd
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.添加极光推送
2.//todo 回款管理的客户接口
上级
f48b0bc8
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
132 行增加
和
2 行删除
+132
-2
build.gradle
app/build.gradle
+6
-1
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+45
-1
JPushReceive.java
...src/main/java/com/wd/workoffice/service/JPushReceive.java
+75
-0
JPushService.java
...src/main/java/com/wd/workoffice/service/JPushService.java
+6
-0
没有找到文件。
app/build.gradle
浏览文件 @
e6b12f34
...
...
@@ -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'
}
app/src/main/AndroidManifest.xml
浏览文件 @
e6b12f34
...
...
@@ -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
app/src/main/java/com/wd/workoffice/service/JPushReceive.java
0 → 100644
浏览文件 @
e6b12f34
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
)
{
}
}
}
app/src/main/java/com/wd/workoffice/service/JPushService.java
0 → 100644
浏览文件 @
e6b12f34
package
com
.
wd
.
workoffice
.
service
;
import
cn.jpush.android.service.JCommonService
;
public
class
JPushService
extends
JCommonService
{
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论