Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
react-native-fcm
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ym
react-native-fcm
Commits
ba4368b4
Commit
ba4368b4
authored
Jun 11, 2017
by
Libin Lu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add schedule notification
parent
f22edb07
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
Examples/simple-fcm-client/app/App.js
Examples/simple-fcm-client/app/App.js
+30
-0
No files found.
Examples/simple-fcm-client/app/App.js
View file @
ba4368b4
...
@@ -28,6 +28,14 @@ export default class App extends Component {
...
@@ -28,6 +28,14 @@ export default class App extends Component {
}
}
}
}
componentDidMount
(){
FCM
.
getInitialNotification
().
then
(
notif
=>
{
this
.
setState
({
initNotif
:
notif
})
});
}
showLocalNotification
()
{
showLocalNotification
()
{
FCM
.
presentLocalNotification
({
FCM
.
presentLocalNotification
({
vibrate
:
500
,
vibrate
:
500
,
...
@@ -39,6 +47,19 @@ export default class App extends Component {
...
@@ -39,6 +47,19 @@ export default class App extends Component {
});
});
}
}
scheduleLocalNotification
()
{
FCM
.
scheduleLocalNotification
({
id
:
'
testnotif
'
,
fire_date
:
new
Date
().
getTime
()
+
5000
,
vibrate
:
500
,
title
:
'
Hello
'
,
body
:
'
Test Scheduled Notification
'
,
priority
:
"
high
"
,
show_in_foreground
:
true
,
picture
:
'
https://firebase.google.com/_static/af7ae4b3fc/images/firebase/lockup.png
'
});
}
render
()
{
render
()
{
let
{
token
,
tokenCopyFeedback
}
=
this
.
state
;
let
{
token
,
tokenCopyFeedback
}
=
this
.
state
;
...
@@ -51,6 +72,11 @@ export default class App extends Component {
...
@@ -51,6 +72,11 @@ export default class App extends Component {
Welcome
to
Simple
Fcm
Client
!
Welcome
to
Simple
Fcm
Client
!
<
/Text
>
<
/Text
>
<
Text
>
Init
notif
:
{
JSON
.
stringify
(
this
.
state
.
initNotif
)}
<
/Text
>
<
Text
selectable
=
{
true
}
onPress
=
{()
=>
this
.
setClipboardContent
(
this
.
state
.
token
)}
style
=
{
styles
.
instructions
}
>
<
Text
selectable
=
{
true
}
onPress
=
{()
=>
this
.
setClipboardContent
(
this
.
state
.
token
)}
style
=
{
styles
.
instructions
}
>
Token
:
{
this
.
state
.
token
}
Token
:
{
this
.
state
.
token
}
<
/Text
>
<
/Text
>
...
@@ -74,6 +100,10 @@ export default class App extends Component {
...
@@ -74,6 +100,10 @@ export default class App extends Component {
<
TouchableOpacity
onPress
=
{()
=>
this
.
showLocalNotification
()}
style
=
{
styles
.
button
}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
showLocalNotification
()}
style
=
{
styles
.
button
}
>
<
Text
style
=
{
styles
.
buttonText
}
>
Send
Local
Notification
<
/Text
>
<
Text
style
=
{
styles
.
buttonText
}
>
Send
Local
Notification
<
/Text
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
scheduleLocalNotification
()}
style
=
{
styles
.
button
}
>
<
Text
style
=
{
styles
.
buttonText
}
>
Schedule
Notification
in
5
s
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
);
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment