You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+71-21Lines changed: 71 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,9 @@
28
28
29
29
<palign="center">
30
30
<ahref="#about">About</a> •
31
+
<ahref="#caution">Caution</a> •
31
32
<ahref="#installation">Installation</a> •
33
+
<ahref="#customize">Customize</a> •
32
34
<ahref="#usage">Usage</a> •
33
35
<ahref="#api">API</a> •
34
36
<ahref="#contribute">Contribute</a> •
@@ -41,14 +43,26 @@
41
43
42
44
# About
43
45
44
-
This plugin help send Local Notification (Android/iOS). You can use it to send notifications to user at the time you want (No Internet need).
46
+
This plugin help send Local Notification (Android/iOS). You can use it to send notifications to user at the time you want, or send daily notification at the specific time you want.
45
47
46
48
This plugin just handle Local Notification, it not support Remote Notification.
47
49
48
50
Was build using automation scripts combine with CI/CD to help faster the release progress and well as release hotfix which save some of our times.
49
51
50
52
Support Godot 3 & 4.
51
53
54
+
# Caution
55
+
56
+
This plugin to support latest Android (13+) and iOS. But there is some thing you must know before using.
57
+
58
+
The notification time may delay a few seconds or even minutes. If the user turn on Battery Optimize mode on their phone, your notifications will delay longer or even not display. The reason for that is i'm trying to not using `unsafe` permissions (Android). Cause it's way to risky, can crash your apps/games and not worth it.
59
+
60
+
On iOS, the minimal `repeating_interval` is 60.
61
+
62
+
You shouldn't show notification when they using your app/game too, it's just annoying them. Schedule to send notifications at specific times like when energy is full, when the tree are mature or st like that...
63
+
64
+
When showing notifications, try to store their tags somewhere, in case you want to remove and schedule new set of notifications.
65
+
52
66
# Installation
53
67
54
68
## Android
@@ -65,6 +79,29 @@ Download the [ios plugin](https://github.com/kyoz/godot-local-notification/relea
65
79
66
80
Enable `LocalNotification` plugin in your ios export preset
67
81
82
+
# Customize
83
+
84
+
On Android, you can change the color of notification by adding `notification-color.xml` to your app/game's `android/build/res/values` folder with content like so:
85
+
86
+
```
87
+
<?xml version="1.0" encoding="utf-8"?>
88
+
<resources>
89
+
<color name="notification_color">#000000</color>
90
+
</resources>
91
+
```
92
+
93
+
Default color are black (#000000)
94
+
95
+
You should also use [this](https://romannurik.github.io/AndroidAssetStudio/icons-notification.html) or [Image Asset Studio](https://developer.android.com/studio/write/create-app-icons) (in Android Studio) to generate your notification icons too, and put them in mipmap folders.
96
+
97
+
The name of notification icon must be `notification_icon.png`
98
+
99
+
```
100
+
android/build/res/mipmap*/notification_icon.png
101
+
```
102
+
103
+
On iOS, the notification icon will be the default App Icon so there's no need to do anything except design your beautiful icon.
104
+
68
105
# Usage
69
106
70
107
You will need to add an `autoload` script to use this plugin more easily.
@@ -75,13 +112,15 @@ Then you can easily use it anywhere with:
Why have to call `init()`. Well, if you don't want to call init, you can change `init()` to `_ready()` on the `autoload` file. But for my experience when using a lots of plugin, init all plugins on `_ready()` is not a good idea. So i let you choose whenever you init the plugin. When showing a loading scene...etc...
@@ -92,30 +131,41 @@ For more detail, see [examples](./example/)
92
131
93
132
## Methods
94
133
95
-
```gdscript
96
-
void show() # sdfjo
97
-
```
134
+
> `isPermissionGranted`() -> bool
98
135
99
-
## Signals
136
+
Use to check current status of permission. return true if permission was granted, false if it is not granted or denied
100
137
101
-
```gdscript
102
-
signal on_error(error_code) # request fail, return error_code
103
-
signal on_completed() # request and show completed
104
-
```
138
+
> `requestPermission`() -> void
139
+
140
+
Use to request permission to show local notification. On Android <= 12, the permission is alway granted. But you should call it anyway, to have clean code base for all version, platforms.
141
+
142
+
> `openAppSetting`() -> void
105
143
106
-
## Error Codes
144
+
Use to open app setting. When user denied one on iOS and twice on Android, the permission dialog will never appear again. So i make this as a handy method for user to jump to App Setting so they can re-active notification.
107
145
108
-
> `ERROR_GOOGLE_PLAY_UNAVAILABLE`
146
+
*WARNING*: After calling `requestPermission()` if `isPermissionGranted()` still return `false`. It's mean user has denied the permission. You can use this function to help user easily toggle notification on. But you should prompt a dialog or st like that to let user know, or choose to open App Setting or not. Just don't jump out of the app without any notify, they will confuse and may never go back to your app again :(
109
147
110
-
Android only. Happen when there's no Google Play Services on the user phone. Rarely happen. Cause normally, they will install your app through Google Play.
148
+
> `show`(title, message, interval, tag) -> void
111
149
112
-
> `ERROR_NO_ACTIVE_SCENE`
150
+
Use to show a notification after `interval` seconds. The `interval` must be greater than 0. And on `iOS` the notification may not show if the app are running on foreground.
113
151
114
-
iOS only. Happen when the plugin can't find active scene. Make sure you calling `show()` method when the app are runing in foreground.
Show daily notification at your choosen hour and minute.
159
+
160
+
> `cancel`(tag) -> void
161
+
162
+
Cancel a notification with it tag. When showing notifications, you should store their tags somewhere, in case you want to cancel em and schedule new set of notifications.
163
+
164
+
## Signals
165
+
166
+
```gdscript
167
+
signal on_permission_request_completed() # emit when the permission request flow completed
0 commit comments