Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
polysoft-nafmii
/
polysoft-android
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4358e8d7
authored
Nov 02, 2021
by
amateur
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1
1 parent
bb1c1fef
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
app/src/main/java/com/whaty/nafmii/activity/JPushTestActivity.java
app/src/main/java/com/whaty/nafmii/activity/JPushTestActivity.java
View file @
4358e8d
...
@@ -7,6 +7,7 @@ import android.view.View;
...
@@ -7,6 +7,7 @@ import android.view.View;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.app.AppCompatActivity
;
import
com.alibaba.fastjson.JSON
;
import
com.polysoft.nafmii.utils.ToastUtils
;
import
com.polysoft.nafmii.utils.ToastUtils
;
import
com.polysoft.nafmii.webview.JsInterfaceHandler
;
import
com.polysoft.nafmii.webview.JsInterfaceHandler
;
import
com.whaty.nafmii.R
;
import
com.whaty.nafmii.R
;
...
@@ -53,7 +54,12 @@ public class JPushTestActivity extends AppCompatActivity implements View.OnClick
...
@@ -53,7 +54,12 @@ public class JPushTestActivity extends AppCompatActivity implements View.OnClick
boolean
pushStopped
=
JPushInterface
.
isPushStopped
(
this
);
boolean
pushStopped
=
JPushInterface
.
isPushStopped
(
this
);
if
(
JPushInterface
.
isNotificationEnabled
(
this
)
==
1
)
{
if
(
JPushInterface
.
isNotificationEnabled
(
this
)
==
1
)
{
buildLocalNotification
(
this
,
"本地标题"
,
"通知内容"
);
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"type"
,
"learn"
);
Map
<
String
,
Object
>
urlMap
=
new
HashMap
<>();
urlMap
.
put
(
"url"
,
"http://ycjytest.cfae.cn/sites/bank/mb/my.html"
);
param
.
put
(
"params"
,
urlMap
);
buildLocalNotification
(
this
,
"本地标题"
,
"通知内容"
,
param
);
}
}
}
}
...
@@ -62,7 +68,7 @@ public class JPushTestActivity extends AppCompatActivity implements View.OnClick
...
@@ -62,7 +68,7 @@ public class JPushTestActivity extends AppCompatActivity implements View.OnClick
JPushInterface
.
setAlias
(
this
,
10000
,
"123"
);
JPushInterface
.
setAlias
(
this
,
10000
,
"123"
);
}
}
public
void
buildLocalNotification
(
Context
context
,
String
tittle
,
String
content
){
public
void
buildLocalNotification
(
Context
context
,
String
tittle
,
String
content
,
Map
<
String
,
Object
>
extras
){
JPushLocalNotification
ln
=
new
JPushLocalNotification
();
JPushLocalNotification
ln
=
new
JPushLocalNotification
();
ln
.
setBuilderId
(
0
);
ln
.
setBuilderId
(
0
);
ln
.
setContent
(
content
);
ln
.
setContent
(
content
);
...
@@ -70,11 +76,9 @@ public class JPushTestActivity extends AppCompatActivity implements View.OnClick
...
@@ -70,11 +76,9 @@ public class JPushTestActivity extends AppCompatActivity implements View.OnClick
long
id
=
System
.
currentTimeMillis
()/
1000
;
long
id
=
System
.
currentTimeMillis
()/
1000
;
ln
.
setNotificationId
(
id
)
;
ln
.
setNotificationId
(
id
)
;
ln
.
setBroadcastTime
(
System
.
currentTimeMillis
());
ln
.
setBroadcastTime
(
System
.
currentTimeMillis
());
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>()
;
if
(
null
!=
extras
)
{
map
.
put
(
"name"
,
"jpush"
)
;
ln
.
setExtras
(
JSON
.
toJSONString
(
extras
))
;
map
.
put
(
"test"
,
"111"
)
;
}
JSONObject
json
=
new
JSONObject
(
map
)
;
ln
.
setExtras
(
json
.
toString
())
;
JPushInterface
.
addLocalNotification
(
context
,
ln
);
JPushInterface
.
addLocalNotification
(
context
,
ln
);
ToastUtils
.
showLong
(
"添加本地通知,notification_id:"
+
id
);
ToastUtils
.
showLong
(
"添加本地通知,notification_id:"
+
id
);
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment