Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
react-native-notifications
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
冷佳娟
react-native-notifications
Commits
cb77df5a
"lib/ios/RNNotifications.xcodeproj/project.pbxproj" did not exist on "bb5b455ec5c577f696650f90dc0333f3218ac2d5"
Commit
cb77df5a
authored
Jul 25, 2018
by
Diego Mello
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update to SDK 27
parent
2c71cd91
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
6 deletions
+23
-6
android/build.gradle
android/build.gradle
+5
-5
android/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java
...tivenotifications/core/notification/PushNotification.java
+18
-1
No files found.
android/build.gradle
View file @
cb77df5a
apply
plugin:
'com.android.library'
apply
plugin:
'com.android.library'
android
{
android
{
compileSdkVersion
2
3
compileSdkVersion
2
7
buildToolsVersion
"2
5
"
buildToolsVersion
"2
7.0.3
"
defaultConfig
{
defaultConfig
{
minSdkVersion
1
6
minSdkVersion
1
9
targetSdkVersion
2
3
targetSdkVersion
2
7
versionCode
1
versionCode
1
versionName
"1.0"
versionName
"1.0"
}
}
...
@@ -20,7 +20,7 @@ android {
...
@@ -20,7 +20,7 @@ android {
dependencies
{
dependencies
{
// Google's GCM.
// Google's GCM.
compile
'com.google.android.gms:play-services-gcm:1
0
.0.1'
compile
'com.google.android.gms:play-services-gcm:1
5
.0.1'
compile
'com.facebook.react:react-native:+'
compile
'com.facebook.react:react-native:+'
...
...
android/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java
View file @
cb77df5a
package
com.wix.reactnativenotifications.core.notification
;
package
com.wix.reactnativenotifications.core.notification
;
import
android.app.Notification
;
import
android.app.Notification
;
import
android.app.NotificationChannel
;
import
android.app.NotificationManager
;
import
android.app.NotificationManager
;
import
android.app.PendingIntent
;
import
android.app.PendingIntent
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
com.facebook.react.bridge.ReactContext
;
import
com.facebook.react.bridge.ReactContext
;
...
@@ -136,13 +138,28 @@ public class PushNotification implements IPushNotification {
...
@@ -136,13 +138,28 @@ public class PushNotification implements IPushNotification {
}
}
protected
Notification
.
Builder
getNotificationBuilder
(
PendingIntent
intent
)
{
protected
Notification
.
Builder
getNotificationBuilder
(
PendingIntent
intent
)
{
return
new
Notification
.
Builder
(
mContext
)
String
CHANNEL_ID
=
"channel_01"
;
String
CHANNEL_NAME
=
"Channel Name"
;
final
Notification
.
Builder
notification
=
new
Notification
.
Builder
(
mContext
)
.
setContentTitle
(
mNotificationProps
.
getTitle
())
.
setContentTitle
(
mNotificationProps
.
getTitle
())
.
setContentText
(
mNotificationProps
.
getBody
())
.
setContentText
(
mNotificationProps
.
getBody
())
.
setSmallIcon
(
mContext
.
getApplicationInfo
().
icon
)
.
setSmallIcon
(
mContext
.
getApplicationInfo
().
icon
)
.
setContentIntent
(
intent
)
.
setContentIntent
(
intent
)
.
setDefaults
(
Notification
.
DEFAULT_ALL
)
.
setDefaults
(
Notification
.
DEFAULT_ALL
)
.
setAutoCancel
(
true
);
.
setAutoCancel
(
true
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
NotificationChannel
channel
=
new
NotificationChannel
(
CHANNEL_ID
,
CHANNEL_NAME
,
NotificationManager
.
IMPORTANCE_DEFAULT
);
final
NotificationManager
notificationManager
=
(
NotificationManager
)
mContext
.
getSystemService
(
Context
.
NOTIFICATION_SERVICE
);
notificationManager
.
createNotificationChannel
(
channel
);
notification
.
setChannelId
(
CHANNEL_ID
);
}
return
notification
;
}
}
protected
int
postNotification
(
Notification
notification
,
Integer
notificationId
)
{
protected
int
postNotification
(
Notification
notification
,
Integer
notificationId
)
{
...
...
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