1
00:00:00,150 --> 00:00:02,240
Hello this is Martez or Corti.

2
00:00:02,400 --> 00:00:09,330
And in this story all we are going to learn about notification channels in Android 8 Odeo.

3
00:00:09,330 --> 00:00:19,170
So first let me tell you that if your app targets the Android or your Android 8 you must use notification

4
00:00:19,170 --> 00:00:23,770
channels in order to actually create notifications for your applications.

5
00:00:24,120 --> 00:00:32,220
But if you're actually targeting it then versions of Android API less than Android 8 or audio you don't

6
00:00:32,220 --> 00:00:37,980
have to use Actually you're not allowed to use the notification channel because the notification channel

7
00:00:38,310 --> 00:00:41,060
is only used for Android 8.

8
00:00:41,280 --> 00:00:47,580
So if you want to create your own Android application when you want to implement the notification channel

9
00:00:48,210 --> 00:00:53,190
it's better to differentiate between these API.

10
00:00:53,190 --> 00:01:01,110
So for example you can create an if statement and say that if the app targets the versions that are

11
00:01:01,110 --> 00:01:07,830
actually listed and relayed then you can create another notification and other type of notification

12
00:01:07,860 --> 00:01:10,150
that I teach in the course.

13
00:01:10,440 --> 00:01:15,480
And if your app targets Android 8 you can create notification channel.

14
00:01:15,720 --> 00:01:22,800
So if you want to learn how to differentiate between API is an android you can watch the custom view

15
00:01:22,860 --> 00:01:24,300
application.

16
00:01:24,400 --> 00:01:31,800
I think this app is actually in the request that section of the course and the last section of the calls

17
00:01:32,340 --> 00:01:37,360
you can find it there and learn how to differentiate between API is in Android.

18
00:01:37,420 --> 00:01:44,820
So are in another application of the course I teach how to use and other type of notification that you

19
00:01:44,820 --> 00:01:53,390
can actually target versions less than and AP Android 8 and learn how to implement that notification.

20
00:01:53,700 --> 00:01:55,920
So with that said now let's actually continue.

21
00:01:55,920 --> 00:02:02,820
First of all let me tell you that you need to actually update your Android SDK packages so you just

22
00:02:02,820 --> 00:02:08,690
need to Android open the Android studio click and configure and here it says STK manager.

23
00:02:08,820 --> 00:02:09,560
Just click on it.

24
00:02:09,600 --> 00:02:13,460
So here we have the manager at the bottom it says show package details.

25
00:02:13,470 --> 00:02:17,330
If I actually select this option we can see the show package details.

26
00:02:17,400 --> 00:02:22,520
So make sure that you actually update the Android SDK pay packages.

27
00:02:22,560 --> 00:02:29,640
For example we have this one Android TV so we don't want to use Android TV in our discourse but as you

28
00:02:29,640 --> 00:02:34,650
can see we have all of these other packages installed on my computer.

29
00:02:34,920 --> 00:02:40,680
And if it really is the key tools here you can see that we have this Android is the key built tool.

30
00:02:40,680 --> 00:02:47,750
So if we if we can show package details here at the bottom now we can see if it actually scroll down.

31
00:02:47,760 --> 00:02:51,580
Here we have all of these as detailed.

32
00:02:51,590 --> 00:02:59,910
These packages installed Android up twenty six point zero point forty point two actually so this is

33
00:02:59,910 --> 00:03:06,300
actually the card and it is the build tools if you want to target Android 8 and here we have GPO debugging

34
00:03:06,300 --> 00:03:09,900
tools so I don't have this one installed on my computer.

35
00:03:09,960 --> 00:03:11,670
We have Android emulator.

36
00:03:11,700 --> 00:03:13,420
Android is the key platform tools.

37
00:03:13,430 --> 00:03:15,240
Make sure to install these packages.

38
00:03:15,240 --> 00:03:19,670
Android SDK tools Android support love library.

39
00:03:19,740 --> 00:03:21,510
We have deep debugging tools.

40
00:03:21,510 --> 00:03:28,260
We have this one Google Play a fixed extension of a licensing library.

41
00:03:28,260 --> 00:03:34,730
Google Play services and we have this Google word driver and here you can see this.

42
00:03:34,770 --> 00:03:38,460
And Intel X 86 emulator accelerator the hag's.

43
00:03:38,450 --> 00:03:45,360
And so if you or your computer has an Intel CPQ you can actually install this package and we have this

44
00:03:45,360 --> 00:03:53,910
one support repository so forth is actually for this package support repository you can install the

45
00:03:53,910 --> 00:03:56,510
constraint play out for android.

46
00:03:56,640 --> 00:04:01,830
We have a solver for constraints lay out because the constraints they are actually the new you need

47
00:04:01,830 --> 00:04:06,840
to actually install these packages because we are going to actually also use the constraints they have

48
00:04:06,870 --> 00:04:08,460
in this application.

49
00:04:08,460 --> 00:04:14,620
So if we have this android support repository it is very important and Google repository and nautically

50
00:04:14,640 --> 00:04:17,400
can apply if you want to install the packages.

51
00:04:17,640 --> 00:04:18,220
OK.

52
00:04:18,330 --> 00:04:19,580
So I went to the can can.

53
00:04:19,580 --> 00:04:26,670
So let's click on Start in your Android studio project the application name is going to be notification

54
00:04:26,670 --> 00:04:31,180
channel and notification channel.

55
00:04:31,410 --> 00:04:37,370
So I just say See and here we have the company domain the product location.

56
00:04:37,380 --> 00:04:44,460
So just to recap next here are let's here because we want to actually only target and rate AP Android

57
00:04:44,500 --> 00:04:51,560
8 and we do not want to differentiate between versions of and with the Android operating system we just

58
00:04:51,560 --> 00:05:02,220
use Android eight point zero as the minimum SDK and we just click on next choose MT activity next and

59
00:05:02,410 --> 00:05:04,960
for the activity name just don't change anything here.

60
00:05:04,950 --> 00:05:06,540
Just click on finish.

61
00:05:06,910 --> 00:05:08,920
So let's wait a little bit here.

62
00:05:08,950 --> 00:05:14,020
So now that a project is created Let's close this dialogue here.

63
00:05:14,200 --> 00:05:19,900
Now on the left hand side we have this and view let's open this folder app and let's open this race

64
00:05:19,930 --> 00:05:20,800
folder.

65
00:05:20,990 --> 00:05:25,870
Let's lay out for that and double click and this activity underline made that example you're going to

66
00:05:25,870 --> 00:05:28,510
design the user interface here first.

67
00:05:28,510 --> 00:05:34,180
So we have this hello overload takes you at the center just selected and then press on delete key on

68
00:05:34,180 --> 00:05:35,730
your keyboard.

69
00:05:35,770 --> 00:05:43,010
Now you're going to actually say that we have an 80 text inside or kind of straitly.

70
00:05:43,030 --> 00:05:46,430
So inside this palette section discrete context.

71
00:05:46,480 --> 00:05:51,540
And in order to find it it takes the first one is takes you and the others here.

72
00:05:51,580 --> 00:05:55,500
For example we have a plain text password text password.

73
00:05:55,510 --> 00:06:02,680
These are 80 texts or in other words text fields that we can enter a value.

74
00:06:02,780 --> 00:06:07,600
OK but this takes view is not a text field it's just a taste really it's just a label.

75
00:06:07,600 --> 00:06:10,230
If you are on are you a symbol of her.

76
00:06:10,300 --> 00:06:16,000
So for these other components for example you can see if you have the time we have that date for example

77
00:06:16,000 --> 00:06:21,580
you can enter the time that if you can enter the date date you can enter the number only number.

78
00:06:21,580 --> 00:06:24,250
All we have this one a number assigned.

79
00:06:24,310 --> 00:06:31,330
Only the signed numbers so what's what is the sign number the signed number is actually the positive

80
00:06:31,390 --> 00:06:34,030
and negative numbers.

81
00:06:34,120 --> 00:06:39,450
And we have the unsigned number that actually only accepts the positive numbers.

82
00:06:39,450 --> 00:06:46,540
So in this case you're going to learn more about these kinds of differentiations in Android If we have

83
00:06:46,540 --> 00:06:48,990
the number decimal only this.

84
00:06:49,240 --> 00:06:56,110
Does it it takes only accepts the simple numbers autocomplete X and Monte autocomplete XP which I actually

85
00:06:56,110 --> 00:06:57,210
teach more about this one.

86
00:06:57,220 --> 00:06:58,620
These ones are later in this course.

87
00:06:58,870 --> 00:07:02,530
But for now we're going to use the plain text.

88
00:07:02,710 --> 00:07:07,730
So just select it and drag it here into this constraint.

89
00:07:07,930 --> 00:07:13,150
And here you can see that we have this component through Section discount punch through section has

90
00:07:13,150 --> 00:07:16,030
a constraint laid out inside this constraint lay out.

91
00:07:16,030 --> 00:07:18,790
We have this edit text right.

92
00:07:18,820 --> 00:07:25,690
So now I put this edit text here and I can see that some constraints at the left hand side and the right

93
00:07:25,690 --> 00:07:26,350
hand side.

94
00:07:26,590 --> 00:07:33,220
I actually created the reason that it has created these constraints for me is that this option here

95
00:07:33,310 --> 00:07:37,850
is iconic and see that it says auto connect feature of the constraint.

96
00:07:38,020 --> 00:07:44,890
This feature is now on turned on and you can see that these constraints are created automatically for

97
00:07:44,890 --> 00:07:50,790
me if you don't want these constraints created for you which you just need to turn off this feature.

98
00:07:51,190 --> 00:07:55,410
So here you can see that we have the left constraint and the right right.

99
00:07:55,420 --> 00:08:00,900
So let's create a constraint to the top to the bottom edge of this tool bar OK.

100
00:08:01,360 --> 00:08:12,480
And now let's select this text and let's say that we have the ID is going to be EDT EDT.

101
00:08:12,580 --> 00:08:19,280
What's movie watch movie and the person on your keyboard.

102
00:08:19,800 --> 00:08:26,480
And for the text you can't just delete the text or actually did it to the text value of these text attributes.

103
00:08:26,700 --> 00:08:36,810
We have this hint attribute and here you can see enter and name of movie.

104
00:08:36,840 --> 00:08:42,630
So here we can see that I actually enter this hardcoded value it is not recommended to use hardcoded

105
00:08:42,660 --> 00:08:50,010
values you can create a strange resource here inside this radius folder inside a string that exemplified.

106
00:08:50,010 --> 00:08:53,310
And then you just need to refer to the name of that string resource.

107
00:08:53,580 --> 00:08:59,910
But here are because we use it in later discourse you're going to learn about this feature or in the

108
00:08:59,910 --> 00:09:04,640
previous application you have learned how to use string strings that I am a find.

109
00:09:04,650 --> 00:09:06,300
We're not going to use it.

110
00:09:06,300 --> 00:09:07,730
But if you want to you can do that.

111
00:09:07,740 --> 00:09:12,420
And it is recommended to use the strings resources so let's person precedented Janet Hubert.

112
00:09:12,630 --> 00:09:14,120
So here is the text.

113
00:09:14,130 --> 00:09:18,220
Let's also just put dot dot dot.

114
00:09:18,360 --> 00:09:20,600
So now is more meaningful.

115
00:09:20,600 --> 00:09:26,540
Now we are going to actually say let's look at a bottom here.

116
00:09:26,560 --> 00:09:28,670
Inside are constantly out.

117
00:09:28,810 --> 00:09:34,010
So inside this pulse section just click on all and then the spot to strike it here below.

118
00:09:34,120 --> 00:09:41,450
This takes you and here you can see that the left constraint and the right hand strike is created.

119
00:09:41,660 --> 00:09:46,750
Let's create a constraint to the bottom edge of this editrix so you can see this little circle.

120
00:09:46,800 --> 00:09:51,020
This green color this green circle that is actually pulsating.

121
00:09:51,020 --> 00:09:53,770
Let's create a connection to the bottom edge of this.

122
00:09:53,810 --> 00:09:55,270
It takes here.

123
00:09:55,330 --> 00:10:01,600
Now the connection is created you can see that this little circle here is now red that is pulsating.

124
00:10:01,940 --> 00:10:14,720
So now let's select this spot in 40 already we can say between BT and votes movie and then present and

125
00:10:14,720 --> 00:10:26,570
future on your keyboard and for the ticks you can say post notification post notification

126
00:10:28,890 --> 00:10:30,540
for movie

127
00:10:34,790 --> 00:10:37,130
and then precedented here on your keyboard.

128
00:10:37,130 --> 00:10:39,340
Post notification for movie.

129
00:10:40,010 --> 00:10:42,830
And here let's add another button.

130
00:10:42,920 --> 00:10:45,590
So just write this posting here.

131
00:10:47,020 --> 00:10:52,300
Do this part and your That's created a connection to the body image of this.

132
00:10:52,540 --> 00:10:57,420
But in here it is post notification for a movie and then select a spot in for the OED.

133
00:10:57,440 --> 00:11:10,690
They've in here between settings billions movie movie settings and then precedented on your keyboard.

134
00:11:11,220 --> 00:11:23,370
And for the text to typing here sittings for movie notification for movie notification

135
00:11:26,380 --> 00:11:29,490
and then person enter key on your keyboard.

136
00:11:29,560 --> 00:11:40,420
So now that we have these buttons and this text here we can go ahead and enter the codes that are required

137
00:11:40,480 --> 00:11:45,160
in order to create a notification or notification Channel for Android 8.

138
00:11:45,160 --> 00:11:47,120
So now let's see how we can do that.

139
00:11:57,710 --> 00:12:04,240
So first of all we need to open the Android view here at the left hand side and we have this job folder

140
00:12:04,330 --> 00:12:06,710
open it and we have this first package right.

141
00:12:06,710 --> 00:12:11,800
Right click on this package here new and then click on Java class.

142
00:12:11,840 --> 00:12:19,450
So for the name of the class we are going to say notification notification handler.

143
00:12:19,850 --> 00:12:25,780
So we're are going to create a handler for the notification that the notification channel that you are

144
00:12:25,780 --> 00:12:32,310
going to create and here you can see that it has a visibility Popbitch modifiers non-thought just don't

145
00:12:32,310 --> 00:12:33,440
add anything here.

146
00:12:33,460 --> 00:12:38,770
Make sure the package is this is the value that you actually specified for the package of your application.

147
00:12:38,770 --> 00:12:42,790
So if you're just right click and this package is going to automatically put this package here.

148
00:12:42,820 --> 00:12:45,280
In other words you don't have to change anything.

149
00:12:45,340 --> 00:12:49,440
Just name the class district technology.

150
00:12:49,480 --> 00:12:54,220
So here it is our class that's DoubleClick and establish order to make this area wider.

151
00:12:54,280 --> 00:13:03,400
Now this class must extend from the context context of wrapper class.

152
00:13:03,550 --> 00:13:07,300
So let's see what is this context wrapper in Android documentation.

153
00:13:07,300 --> 00:13:13,090
So here it is our documentation you can search in Google context wrapper or you can just enter this

154
00:13:13,090 --> 00:13:19,510
you are a developer and right dot com slash defense slash Android slash content slash context wrapper

155
00:13:19,750 --> 00:13:21,510
that ASTM it.

156
00:13:21,550 --> 00:13:27,960
So here you can see that this class directly extends from the context class.

157
00:13:28,210 --> 00:13:32,110
So the context wrapper class is actually the context.

158
00:13:32,110 --> 00:13:32,930
Right.

159
00:13:32,950 --> 00:13:40,840
And here it says proxying implementation of context that simply delegates all of its calls to another

160
00:13:40,840 --> 00:13:48,130
context can be subclassed to modify behavior without changing the original context.

161
00:13:48,130 --> 00:13:51,430
So first let's see what is context.

162
00:13:51,430 --> 00:13:57,040
So I just opened another tap here for you and I searched for what is context in Android.

163
00:13:57,040 --> 00:14:00,160
We have this line here in stack overflow.

164
00:14:00,160 --> 00:14:02,180
So I just click on this link here.

165
00:14:03,070 --> 00:14:05,020
What is context that Android.

166
00:14:05,260 --> 00:14:09,470
And I'm going to just scroll down here so here it is the accepted answer.

167
00:14:09,490 --> 00:14:18,580
It says putting it simply as this name suggests it's the context of current state of the application

168
00:14:18,610 --> 00:14:19,750
or object.

169
00:14:19,750 --> 00:14:25,680
It lists newly created objects understand what has been going on.

170
00:14:25,690 --> 00:14:32,610
Typically you Corlett to get information regarding another part of your program.

171
00:14:33,220 --> 00:14:34,440
This is really important.

172
00:14:34,480 --> 00:14:39,790
You just cut the context to get information regarding another part of our program.

173
00:14:40,090 --> 00:14:46,540
It is you can get the context but if by invoking the application context context Meffert get base context

174
00:14:46,540 --> 00:14:52,990
Meffert or it's then in a class that extends from the context such as the application activity service

175
00:14:53,260 --> 00:15:01,930
and intense service class we use context to access the features outside of our activity.

176
00:15:02,320 --> 00:15:05,650
So in this case you want to use the notification channel.

177
00:15:05,800 --> 00:15:08,150
That's why we use context here.

178
00:15:08,350 --> 00:15:13,580
You want to access some other features that are actually outside of our activity.

179
00:15:13,720 --> 00:15:18,990
So if you're going to use the context wrapper class which is a subclass of the context class.

180
00:15:19,000 --> 00:15:27,070
So let's open our Android studio here to consider our class notification handler class extends from

181
00:15:27,070 --> 00:15:33,070
the context wrapper but it's sooner or later and it says there is no default constructor available in

182
00:15:33,070 --> 00:15:38,170
Android that content that context wrapper so we need to create a constructor inside this class.

183
00:15:38,230 --> 00:15:44,110
So first we need to say that it is public the name of the constructor must be as the name as the name

184
00:15:44,110 --> 00:15:44,880
of the class.

185
00:15:44,880 --> 00:15:50,190
So notification handler and I just put a pair of practice's here.

186
00:15:50,240 --> 00:15:55,290
This constructor is going to accept an argument of type context.

187
00:15:55,300 --> 00:15:57,970
So we're going to create a create a parameter here.

188
00:15:57,970 --> 00:16:02,850
So what's the difference between plie here and argument.

189
00:16:02,920 --> 00:16:08,290
The argument is the actual value that we passed to some effort by the parameter is when you actually

190
00:16:08,290 --> 00:16:11,110
declare a prime it'll for you for your method.

191
00:16:11,110 --> 00:16:11,740
OK.

192
00:16:11,950 --> 00:16:17,860
So whenever For example later when we actually call this constructor we want to pass an argument of

193
00:16:17,870 --> 00:16:18,960
tokens context.

194
00:16:18,970 --> 00:16:25,660
It is called argument but when we want to create it we are going to say if we have a plummet here of

195
00:16:25,660 --> 00:16:33,220
type context for this method it's so that's the difference between an argument and a prime actor in

196
00:16:33,220 --> 00:16:33,910
Android.

197
00:16:33,910 --> 00:16:43,130
So inside is constructor we can say that need to call the super constructor super and to pass the context.

198
00:16:43,130 --> 00:16:44,060
That's it.

199
00:16:44,080 --> 00:16:49,760
So now inside is class if you're going to create some instance variables.

200
00:16:49,760 --> 00:16:57,410
So the first instance variable that we are going to create inside our class is going to be of type notification

201
00:16:57,410 --> 00:16:58,120
manager.

202
00:16:58,280 --> 00:17:06,600
So we're going to say private notification manager notification manager and the name is going to be

203
00:17:06,600 --> 00:17:08,300
a notification manager semicolon.

204
00:17:08,360 --> 00:17:14,540
Now we're going to create another instance variable but this time this instance variable is going to

205
00:17:14,540 --> 00:17:20,170
be public because we want to use this instance variable from another class main activity.

206
00:17:20,480 --> 00:17:25,310
So we're trying to say public static final.

207
00:17:25,340 --> 00:17:27,830
So as you can see this is actually a constant.

208
00:17:27,860 --> 00:17:29,300
This is not a regular variable.

209
00:17:29,300 --> 00:17:30,440
This is a constant.

210
00:17:30,470 --> 00:17:32,990
And when it is created it it cannot be changed.

211
00:17:32,990 --> 00:17:36,430
They do it and it is initialized it cannot be changed later.

212
00:17:36,740 --> 00:17:44,490
So public static final and the name of this variable here is going to be watching movies so whenever

213
00:17:44,540 --> 00:17:47,270
you create a constant in Android.

214
00:17:47,270 --> 00:17:51,780
Make sure to actually make it uppercase instead of a lowercase.

215
00:17:51,800 --> 00:17:57,170
So all of these letters all of the letters of the name of this constant should be uppercase I'm going

216
00:17:57,170 --> 00:18:12,250
to say Vought underline movie Bodyline and notification channel notification other live chat on other

217
00:18:12,540 --> 00:18:19,720
line ID so there is that I actually chose this last name is that I wanted this to be actually meaningful

218
00:18:19,720 --> 00:18:20,420
for you.

219
00:18:20,710 --> 00:18:26,300
So if you're creating your own idea you don't have to actually choose our name like this one.

220
00:18:26,350 --> 00:18:32,380
You can just choose a short short shorter name but I just want to make it more meaningful for you.

221
00:18:32,440 --> 00:18:38,830
So I'm gonna choose this name and as you can see here I didn't specify the data type of this constant

222
00:18:38,830 --> 00:18:43,060
so that is fine and we need to specify the type which is actually strange.

223
00:18:43,480 --> 00:18:45,310
And I put two codes here.

224
00:18:45,490 --> 00:18:58,400
And as the value I'm going to say watch a movie notification noti fixation channel semicolon.

225
00:18:58,670 --> 00:19:03,940
So let's actually say create a new line here.

226
00:19:03,970 --> 00:19:10,580
Now this is the idea about notification and right now when it is specify a name for it for notification

227
00:19:10,580 --> 00:19:14,880
Channel and this name is going to be visible to the user.

228
00:19:15,170 --> 00:19:15,500
OK.

229
00:19:15,500 --> 00:19:25,960
So again it is actually the public static final strange and here I'm going to say what movie notification

230
00:19:25,960 --> 00:19:28,320
name so I'm going to copy this name here.

231
00:19:29,210 --> 00:19:30,480
And I'm going to put it here.

232
00:19:30,690 --> 00:19:38,670
And instead of ID I'm going to say name assignment operator and as the as the value we're going to say

233
00:19:38,860 --> 00:19:41,300
watch movie notification.

234
00:19:41,370 --> 00:19:46,620
So here we said watch movie notification channel ID as the value here we need to pack if you need to

235
00:19:46,620 --> 00:19:53,010
add ID here to the value of this constant here watch moving notification channel ID.

236
00:19:53,400 --> 00:19:58,860
And if you're trying to copy disvalue here and we will be able to paste it here as the value of this

237
00:19:58,860 --> 00:20:03,030
constant And we are instead of the we are going to say nay.

238
00:20:03,660 --> 00:20:09,980
So make sure that these two values are actually different because this is our ID and this is the name.

239
00:20:10,320 --> 00:20:12,050
So we just put a semicolon here.

240
00:20:13,080 --> 00:20:21,230
Now that we have this instance is actually created inside our class we can go ahead and create a method

241
00:20:21,300 --> 00:20:24,270
in order to create the notification channels.

242
00:20:24,570 --> 00:20:32,100
But here instead of actually using these long winded values for example we can actually use only the

243
00:20:32,160 --> 00:20:34,170
first letter of each word.

244
00:20:34,170 --> 00:20:46,380
So for watch moving notification channel Id say W M What movie notification channel ID right or for

245
00:20:46,380 --> 00:20:53,430
this video here again we can see viage movie notification channel name.

246
00:20:53,490 --> 00:20:57,720
So as the last name we just put the whole word here.

247
00:20:57,750 --> 00:20:58,990
So its much more better.

248
00:20:59,190 --> 00:21:06,270
And it can be more Beder if you want to show this value with its name to the user because it is actually

249
00:21:06,270 --> 00:21:09,400
a user visible value.

250
00:21:09,540 --> 00:21:16,350
So let's scroll down here after this structure that we created inside this notification handler class.

251
00:21:16,590 --> 00:21:23,610
Are going to create a method and lets say that this method is actually Puplick because we are going

252
00:21:23,610 --> 00:21:26,590
to use this method from our main activity class.

253
00:21:26,610 --> 00:21:34,320
So we are meant to stay private and return type of this if it is void the name of this method is going

254
00:21:34,320 --> 00:21:40,820
to be create notification notification channel.

255
00:21:40,880 --> 00:21:46,060
And then I just put a pair of this year let's open and close this method by using these curly braces.

256
00:21:46,070 --> 00:21:52,400
So first thing inside is create notification channel Meffert we are going to create an object of type

257
00:21:52,490 --> 00:21:53,830
notification channel.

258
00:21:54,050 --> 00:22:01,140
So we going to see notification channel and the name is going to be notification channel assignment

259
00:22:01,140 --> 00:22:05,160
operator new notification channel object.

260
00:22:05,190 --> 00:22:11,340
So here we are creating a notification Tennent object and we are assigning get to this variable name

261
00:22:11,430 --> 00:22:12,950
as notification channel.

262
00:22:13,260 --> 00:22:19,650
So new ratifications are here we need to pass some arguments first we need to pass the ID.

263
00:22:19,860 --> 00:22:25,920
So I'm going to just type in your ID and it's going to find our constants here so we need to actually

264
00:22:27,180 --> 00:22:31,020
name it as watch movie notification channel.

265
00:22:31,020 --> 00:22:40,070
So the first one here is the ID come to and now you need to pass the name the name here is watch movie

266
00:22:40,070 --> 00:22:41,410
notification channel name.

267
00:22:41,420 --> 00:22:43,200
So the second one is name.

268
00:22:43,640 --> 00:22:49,160
Or we can actually just delete the idea and just with the name here comma that create a new line so

269
00:22:49,160 --> 00:22:50,740
that we can see what's going on here.

270
00:22:50,750 --> 00:22:56,870
So we passed the OED as the first document the second argument is the name and the final argument is

271
00:22:56,900 --> 00:22:58,420
going to be the importance.

272
00:22:58,430 --> 00:23:05,420
So the importance attribute is going to specify the priority of notification.

273
00:23:05,450 --> 00:23:08,070
So I'll talk more about this feature later.

274
00:23:08,150 --> 00:23:14,200
For now we need to refer first we need to refer to our notification manager instance variable.

275
00:23:14,390 --> 00:23:19,400
I notice that we haven't still initialized this variable going to initialize it later.

276
00:23:19,400 --> 00:23:25,670
Just for now just referred to our instance variable notification manager dot and here I'm going to type

277
00:23:25,670 --> 00:23:26,060
in here.

278
00:23:26,090 --> 00:23:32,240
Importance just like in here hit importance with a capital letter is we have importance high importance

279
00:23:32,240 --> 00:23:36,210
low max default mean non unspecified.

280
00:23:36,250 --> 00:23:37,700
For now let's choose default.

281
00:23:37,700 --> 00:23:43,780
I'll talk more about these other values for now just choose importance underline default.

282
00:23:43,850 --> 00:23:46,160
So let me create a new line here.

283
00:23:46,450 --> 00:23:50,070
And finally we need to put a semicolon at the end of our statement.

284
00:23:50,080 --> 00:23:54,420
So now we need to specify the attributes of what modification to.

285
00:23:54,640 --> 00:23:58,950
So I'm going to paste some lines of code here so as you can see these are the lines of code that I pasted

286
00:23:58,960 --> 00:23:59,890
here.

287
00:23:59,920 --> 00:24:07,090
First of all we actually specifying the Enable lights of the notification channel and we pass the value

288
00:24:07,090 --> 00:24:09,010
true to this method.

289
00:24:09,100 --> 00:24:13,290
So let me hold down the comment on my keyboard and then click on this method here.

290
00:24:13,330 --> 00:24:18,340
If you are using a Windows you just need to hold down the control on your keyboard and then click on

291
00:24:18,340 --> 00:24:19,380
this method.

292
00:24:19,780 --> 00:24:24,820
So here it is the main thread and here it is the documentation of this method and if you cannot access

293
00:24:24,820 --> 00:24:30,370
the documentation of this method you can easily just search for this method in Google in order to find

294
00:24:30,400 --> 00:24:32,250
the on line documentation.

295
00:24:32,560 --> 00:24:40,300
So here it says sets whether ratifications posted through this channel should display notification lights

296
00:24:40,660 --> 00:24:43,850
on devices that support this feature.

297
00:24:44,050 --> 00:24:48,380
OK so it is going to specify the notification lights.

298
00:24:48,400 --> 00:24:57,370
Let me actually close this one here and now we have this method so we have this one set light color

299
00:24:57,370 --> 00:24:58,590
color of that red.

300
00:24:58,780 --> 00:25:01,110
So it's actually self-explanatory.

301
00:25:01,480 --> 00:25:04,320
And here we have the set show badge.

302
00:25:04,330 --> 00:25:06,270
True we passed the value of this method.

303
00:25:06,370 --> 00:25:09,690
Let me actually take you to the documentation of this.

304
00:25:09,730 --> 00:25:18,460
It says sets or the ratifications posted to this channel can appear as application icon badges.

305
00:25:19,300 --> 00:25:21,280
In a launcher.

306
00:25:21,310 --> 00:25:26,450
OK so you can actually specify an icon for your notification.

307
00:25:26,690 --> 00:25:28,670
So let's close this file.

308
00:25:28,690 --> 00:25:30,750
So we passed the body of truth to this method.

309
00:25:30,760 --> 00:25:34,860
Here we have this method not an internal data set.

310
00:25:34,910 --> 00:25:41,400
Lock screen visibility notification that visibility public if asked Is this a valid reason.

311
00:25:41,410 --> 00:25:44,050
So let's take a look at this the documentation of this.

312
00:25:44,070 --> 00:25:52,930
If it is sets whether notification is posted to this channel appear on the luckiest screen or not and

313
00:25:52,930 --> 00:25:58,280
if so whether they appear in the data for.

314
00:25:58,630 --> 00:26:06,160
So here this Smurfette sets like a screen visibility is going to specify whether you can show this notification

315
00:26:06,490 --> 00:26:09,730
on the screen or not.

316
00:26:09,730 --> 00:26:11,080
So let's close this file.

317
00:26:11,380 --> 00:26:15,470
And finally we have get notification manager Meffert.

318
00:26:15,610 --> 00:26:18,720
So we haven't still called created the Smurfette.

319
00:26:18,850 --> 00:26:22,620
But here we are just calling the Smurfette in order to get the notification manager.

320
00:26:22,640 --> 00:26:28,420
Remember I told you that we haven't still initialized our notification manager instance variable.

321
00:26:28,660 --> 00:26:31,940
So here are inside this method that we are going to create later.

322
00:26:32,050 --> 00:26:37,960
We are going to initialize our notification manager and we are going to return the initialized notification

323
00:26:37,960 --> 00:26:39,780
manager object from this method.

324
00:26:40,060 --> 00:26:47,600
So it is gets much a manager that create notification channel and we just passed the notification channel.

325
00:26:47,650 --> 00:26:48,920
Object to this method.

326
00:26:49,210 --> 00:26:54,090
So after the end in curly brace of this create notification Tanel Mefford.

327
00:26:54,400 --> 00:27:00,760
Let's create a method here but here I notice that I actually declare to dismiss it as private.

328
00:27:00,790 --> 00:27:05,870
It should be public because the main activity class is going to access this method later.

329
00:27:05,950 --> 00:27:11,830
So public Woit creates a notification channel and hear it before the ending curly brace or what class

330
00:27:12,280 --> 00:27:14,040
I am going to say private.

331
00:27:14,050 --> 00:27:19,230
So now we can actually declare or dismiss it as private void or private.

332
00:27:19,230 --> 00:27:26,890
Our notification manager you need to specify the tenth value for my friend gets notification manager

333
00:27:27,190 --> 00:27:32,560
get a manager or a pair of prentices so that it's open and close this method by using the curly braces

334
00:27:33,730 --> 00:27:40,530
and inside this method we can say that if the notification manager rowdier it but that we created above

335
00:27:40,920 --> 00:27:47,460
is actually no and it is not initialized then we can open and close this if statement by using these

336
00:27:47,460 --> 00:27:51,900
curly braces we can say notification manager assignment operator.

337
00:27:52,030 --> 00:28:01,780
So we need to cast this object to our notification manager object say Get system service context that

338
00:28:02,440 --> 00:28:04,730
notification service semicolons.

339
00:28:04,790 --> 00:28:12,060
So remember I told you that by using the context class we can access the features outside of our activity.

340
00:28:12,070 --> 00:28:18,040
So here it is one example you can access the notification service by using the context select and create

341
00:28:18,100 --> 00:28:20,440
a new line so that he can see what's going on here.

342
00:28:20,470 --> 00:28:25,960
So now in this way we can initialize our notification manager opti after the end in Crilley place of

343
00:28:25,960 --> 00:28:27,200
this if statement.

344
00:28:27,250 --> 00:28:33,570
We can't just say in return notification manager vacation manager.

345
00:28:33,570 --> 00:28:40,390
So now whenever we actually call this method not get notification manager we can get the initialized

346
00:28:40,450 --> 00:28:43,580
up of up notification manager.

347
00:28:43,710 --> 00:28:53,500
OK now here it's time to create the actual notification object that you're going to post to the user's

348
00:28:53,500 --> 00:28:54,560
device.

349
00:28:54,880 --> 00:28:57,500
So if you need to create an error method for that.

350
00:28:57,910 --> 00:29:03,430
So before the ending brace of our notification handler class you are going to say Puplick.

351
00:29:03,430 --> 00:29:07,580
Again this method is public because we are going to use it later from another class.

352
00:29:07,810 --> 00:29:17,660
Public notification dot builder notification that builder This is the type and the name of them if it

353
00:29:17,660 --> 00:29:29,690
is going to be create and return watch movie notification watch movie notification and put pair apparent

354
00:29:29,680 --> 00:29:30,930
Apprentice's here.

355
00:29:32,300 --> 00:29:35,630
And we need to specify some parameters for this method.

356
00:29:35,960 --> 00:29:43,270
So it is going to be of types three and the first one is going to be three title text comma.

357
00:29:43,450 --> 00:29:44,300
Strange.

358
00:29:45,120 --> 00:29:46,150
Body Text.

359
00:29:46,320 --> 00:29:48,690
The name is but it is the name of this parameter.

360
00:29:48,930 --> 00:29:52,580
So let me create a new line here so that you can see what's going on here.

361
00:29:52,590 --> 00:29:54,060
So these are the parameters.

362
00:29:54,180 --> 00:29:57,500
This story in the title text string by the text.

363
00:29:57,720 --> 00:30:00,750
Let's open and close this method by using these curly braces.

364
00:30:00,750 --> 00:30:07,610
We can say return new We're going to create a new object of type notification that build there.

365
00:30:07,830 --> 00:30:14,640
So notification that builder Now we to some arguments the first one is the actually the context so we

366
00:30:14,640 --> 00:30:18,260
can say good application context in order to get the context.

367
00:30:18,260 --> 00:30:21,400
Comma I meant to pass the channel ID.

368
00:30:21,420 --> 00:30:22,670
That is strange.

369
00:30:22,890 --> 00:30:25,750
So we already created our channel ID.

370
00:30:25,920 --> 00:30:31,980
So the name is a watch movie notification channel ID so we can pass that value here.

371
00:30:31,980 --> 00:30:38,670
Watch movie notification channel ID.

372
00:30:38,790 --> 00:30:39,960
So here it is the ID.

373
00:30:39,960 --> 00:30:46,460
So here let me create a new line after this come or we can create a new line and we can see that we

374
00:30:46,460 --> 00:30:49,840
are actually creating a new object type notification that builder.

375
00:30:49,980 --> 00:30:57,780
Here are the arguments that we passed to the constructor get application context watch movie notification

376
00:30:57,780 --> 00:30:58,810
channel ID.

377
00:30:58,890 --> 00:31:00,540
So lets see what we are going to do next.

378
00:31:00,570 --> 00:31:03,020
So here is the object right.

379
00:31:03,260 --> 00:31:05,850
The new and here it is the whole object.

380
00:31:05,970 --> 00:31:14,160
And here we can call a method on this object like calling it an invaluable or a method maybe.

381
00:31:14,280 --> 00:31:18,590
So we can say that sits.

382
00:31:18,680 --> 00:31:19,460
So here it is.

383
00:31:19,520 --> 00:31:20,470
Here in Memphis.

384
00:31:20,470 --> 00:31:26,040
So for example we have set small icon set auto cancels set content text.

385
00:31:26,210 --> 00:31:32,840
We have the title text or we have the sets content title actually.

386
00:31:33,230 --> 00:31:33,980
So here we are.

387
00:31:34,010 --> 00:31:38,000
We call this method and we passed the title text to dismiss it.

388
00:31:38,630 --> 00:31:50,090
And that can create a new line and say that set content sits content to text so if you have the content

389
00:31:50,090 --> 00:31:57,680
title that be called before and B have the content text so the text is going to be body text to be passed

390
00:31:57,730 --> 00:32:01,200
to put the text that is again on the line.

391
00:32:01,210 --> 00:32:08,600
We can also specify an icon for our notification so we can say that set smile icon.

392
00:32:08,770 --> 00:32:14,620
So we haven't actually created an icon for notification but now I am going to show you how you can do

393
00:32:14,620 --> 00:32:14,830
that.

394
00:32:14,820 --> 00:32:16,820
So let's open the Android view.

395
00:32:17,080 --> 00:32:21,910
And if you want to know how to open the Android you just need to at the top you just need to click on

396
00:32:21,910 --> 00:32:26,770
view to Windows and then project or you can use the shortcut.

397
00:32:26,770 --> 00:32:30,200
So for Mac it is a command to one.

398
00:32:30,670 --> 00:32:33,910
So here we have this arrest folder.

399
00:32:34,000 --> 00:32:40,060
So we just need to right click on the rest folder here and we can go to New and then click on image

400
00:32:40,170 --> 00:32:43,260
asset or you can actually create a vector asset.

401
00:32:43,270 --> 00:32:45,790
But here we are going to create an image asset.

402
00:32:46,420 --> 00:32:49,540
And here we have this icon type.

403
00:32:49,540 --> 00:32:51,930
Click on this little triangle here.

404
00:32:52,550 --> 00:32:56,270
So are going to specify the type of the icon that we are going to create.

405
00:32:56,290 --> 00:32:58,240
We have the lantern icons.

406
00:32:58,240 --> 00:33:02,910
We have the action bar and tap icons and we have the notification icons.

407
00:33:02,940 --> 00:33:05,370
So just click on it and here it is.

408
00:33:05,400 --> 00:33:06,250
It is the name.

409
00:33:06,530 --> 00:33:08,490
So for the name just typing here.

410
00:33:08,560 --> 00:33:11,330
Watch underly movie.

411
00:33:11,350 --> 00:33:12,670
And we have that as a type.

412
00:33:12,670 --> 00:33:17,120
We have the image clipart the text so just choose clip art.

413
00:33:17,380 --> 00:33:21,490
And we have the clip so just click on these little Android image these clipart.

414
00:33:21,490 --> 00:33:26,550
So here this window is open for you so that you can choose an icon in say the search area.

415
00:33:26,560 --> 00:33:36,320
Just search for movie or watch or maybe movie.

416
00:33:36,330 --> 00:33:42,360
So here we have for example this one local movie movie two in box so we can actually choose this one

417
00:33:42,450 --> 00:33:43,740
movie right.

418
00:33:43,750 --> 00:33:46,530
Or movie Creation or some other icons.

419
00:33:46,540 --> 00:33:53,180
So just search for a specific icon that is actually related to your notification I just click on OK.

420
00:33:53,340 --> 00:33:54,690
Now it's 3 am.

421
00:33:54,700 --> 00:33:55,140
No.

422
00:33:55,150 --> 00:33:57,680
If you want to you can specify some attributes here.

423
00:33:57,690 --> 00:34:01,740
I just am just going to leave it as default and I'm just going to click on next.

424
00:34:01,750 --> 00:34:09,530
As you can see here it is going to create some variations of the icon we have x x HTP.

425
00:34:09,790 --> 00:34:16,150
So this icon is going to be used for more now actually high quality resolutions devices.

426
00:34:16,150 --> 00:34:19,340
We have a switch the CPI HTP and NDP.

427
00:34:19,480 --> 00:34:25,380
So these are the icons that are going to be created and your app according to the device that your appearance

428
00:34:25,450 --> 00:34:32,980
on is going to actually take automatically the specific icon that is actually suitable for that device

429
00:34:33,370 --> 00:34:35,000
and just click on x.

430
00:34:35,020 --> 00:34:40,150
So here again you can see that it's going to actually specify the location that your icon is going to

431
00:34:40,150 --> 00:34:42,380
be saved inside the tribal folder.

432
00:34:42,730 --> 00:34:46,170
And here just don't change anything just click on the image.

433
00:34:46,270 --> 00:34:52,540
Now inside destroy Bill folder we have our motto watch underline movie the P.A. we have four images

434
00:34:52,950 --> 00:34:56,870
STPI and x and x x x.

435
00:34:57,160 --> 00:35:05,470
So inside the practices of these sets smart I can MFL it because they are taught bell that watch underline

436
00:35:05,470 --> 00:35:06,170
movie.

437
00:35:06,540 --> 00:35:06,890
OK.

438
00:35:06,910 --> 00:35:10,530
So let me double click on the step in order to make this area wider.

439
00:35:10,870 --> 00:35:16,520
And the next attribute that we want to specify is that sets or to cancel.

440
00:35:16,990 --> 00:35:19,930
And we want to pass the truth to the Smurfette.

441
00:35:19,960 --> 00:35:25,320
So here let's click on the set of the handsome effort in order to see the documentation of this if it

442
00:35:25,330 --> 00:35:32,030
says make this if a notification automatically dismissed when the user touches it.

443
00:35:32,140 --> 00:35:34,620
So we just pass the value true to the Smurfette.

444
00:35:34,770 --> 00:35:36,090
Let me close this file.

445
00:35:37,490 --> 00:35:40,530
And if you want to you can specify some other attributes.

446
00:35:40,610 --> 00:35:43,700
So you just need to put that in here.

447
00:35:43,700 --> 00:35:46,680
For example we have some other attributes or methods.

448
00:35:46,940 --> 00:35:51,430
For example we have an action you can add an action to this.

449
00:35:51,920 --> 00:35:57,460
But if vacation add extras add person extend such actions.

450
00:35:57,710 --> 00:36:07,260
We have set badge icon typeset category so lots of for example set color set colorized set content intent.

451
00:36:07,280 --> 00:36:15,830
So in order to see how this fits works you need to actually search for these methods in Google or in

452
00:36:15,830 --> 00:36:21,350
order to find them in for example in stack overflow which is a great Web site if you want to find solutions

453
00:36:21,350 --> 00:36:22,960
for your apps.

454
00:36:23,180 --> 00:36:28,560
Or you can just read the documentation and you don't have to read always read the documentation.

455
00:36:28,760 --> 00:36:33,960
But for example I'm going to show you an example for example set action right.

456
00:36:33,970 --> 00:36:38,470
For example set action for our notification.

457
00:36:38,480 --> 00:36:40,270
So we need to open the Google.

458
00:36:40,490 --> 00:36:42,080
So let me open the web browser.

459
00:36:42,080 --> 00:36:47,550
So here inside the search area we can't say set action.

460
00:36:47,820 --> 00:36:48,310
OK.

461
00:36:48,560 --> 00:36:50,980
Notification not the fixation.

462
00:36:50,990 --> 00:36:56,420
So you just need to put some important keywords inside the search area notification and right.

463
00:36:56,630 --> 00:36:57,330
That's it.

464
00:36:57,330 --> 00:36:59,510
I just to a person on my keyboard.

465
00:36:59,810 --> 00:37:06,770
So here we have a stack overflow post and we here we have the official word and documentation notification

466
00:37:06,770 --> 00:37:07,720
that builder.

467
00:37:07,970 --> 00:37:09,050
So I'm just going to click on it.

468
00:37:09,050 --> 00:37:15,030
So here it is the android documentation and inside its documentation I'm going to search for a method.

469
00:37:15,260 --> 00:37:20,190
So I'm just going to hold down the command on my keyboard and then press on the leader on my keyboard.

470
00:37:20,390 --> 00:37:25,370
And if you are using a Windows machine you just need to hold down the control key on your keyboard and

471
00:37:25,370 --> 00:37:27,600
then present the letter F key on your keyboard.

472
00:37:27,830 --> 00:37:31,490
So I'm going to search for a method set actions.

473
00:37:31,760 --> 00:37:33,240
So take a look at this Meffert.

474
00:37:33,290 --> 00:37:39,440
It has altered the complete list of actions attached to this notification.

475
00:37:39,890 --> 00:37:47,200
So by using the Smurfette we can actually alter the actions but in order to alter the action first you

476
00:37:47,240 --> 00:37:50,320
need to add an action to your notification.

477
00:37:50,480 --> 00:37:56,060
So if I actually scroll to the top here you can see it's public if it's the first one is an action and

478
00:37:56,060 --> 00:37:59,900
this action exits and accepts some arguments.

479
00:37:59,900 --> 00:38:06,350
The icon which is of the integer char sequence which is actually the title it is actually the same to

480
00:38:06,440 --> 00:38:08,200
the string data type.

481
00:38:08,360 --> 00:38:11,930
And we have the pending intent intent this method.

482
00:38:11,930 --> 00:38:19,170
It is actually deprecated in API level 23 and it says use an action action.

483
00:38:19,190 --> 00:38:25,760
So if we have this method of action that accepts notification that action action and an action to this

484
00:38:25,760 --> 00:38:26,300
notification.

485
00:38:26,300 --> 00:38:28,130
So I'm just going to click on this Mefford.

486
00:38:28,430 --> 00:38:34,400
So here it says notification that builder at action it is an action to these notifications actions are

487
00:38:34,400 --> 00:38:40,320
typically displayed by the system as a button Aitcheson to the notification content.

488
00:38:40,520 --> 00:38:42,350
Every action must have an icon.

489
00:38:42,380 --> 00:38:49,930
So notice that it says must have an icon first to be square and matching the holo dark action bar visuals.

490
00:38:49,940 --> 00:38:57,290
So it is actually a hint or for you or me or actually a tip for you so that you can actually specify

491
00:38:57,290 --> 00:39:05,090
the design of your app and it has a textual label and appending intent or notification in its expanded

492
00:39:05,090 --> 00:39:10,460
form can display up to free actions from left to right in order.

493
00:39:10,460 --> 00:39:17,900
The other added actions will not be displayed when the notification is collapsed however so be sure

494
00:39:18,170 --> 00:39:23,900
that any essential functions may be accessed by the user in some other way.

495
00:39:23,900 --> 00:39:29,230
For example in the activity pointed to by content intent.

496
00:39:29,480 --> 00:39:31,230
So here it is the method.

497
00:39:31,670 --> 00:39:36,670
And lets actually click on this pending content and see what is this pending intent.

498
00:39:36,710 --> 00:39:41,170
So you can I should read the documentation of this pending intent and see what is the spending intent.

499
00:39:41,490 --> 00:39:46,300
And by the way in the next story only the next application that we are going to build in this course

500
00:39:46,670 --> 00:39:51,470
we are going to learn more about pending intent and how to add an action to our identifications.

501
00:39:51,680 --> 00:39:57,160
But for this notification channel I'm just going to show you how it is implemented for Android.

502
00:39:57,200 --> 00:40:00,420
So now let's go back to android studio here.

503
00:40:00,650 --> 00:40:09,050
So it's enough for these attributes again if you want to you can specify some other actions or for example

504
00:40:09,050 --> 00:40:13,940
attributes for your ratification but for our application it's you know finally we just put a semicolon

505
00:40:13,940 --> 00:40:20,760
at the end of our statement said although he has said and done so let me add these spaces here.

506
00:40:20,840 --> 00:40:27,860
And the final method that we are going to create inside our notification handler class is called notify

507
00:40:27,860 --> 00:40:29,020
the user.

508
00:40:29,270 --> 00:40:36,020
So after the end in curly brace of our Meffert create and return watch moving notification I am going

509
00:40:36,020 --> 00:40:45,880
to say again Voyt notify notified the user and then pull up her refracts this year we are going to specify

510
00:40:46,140 --> 00:40:54,690
some parameters what this method the first trimester is going to be of type integer so int ID karma

511
00:40:55,580 --> 00:41:04,710
or can say notification ID it's more meaningful notification Id come up notification that builder notification

512
00:41:04,710 --> 00:41:11,120
that builder and here the name is going to be notification builder situation.

513
00:41:12,410 --> 00:41:12,930
BUILDER.

514
00:41:12,950 --> 00:41:16,350
So just open and close the Smurfit by using these curly braces.

515
00:41:16,730 --> 00:41:18,520
Let's create a new line here.

516
00:41:20,150 --> 00:41:21,660
So now inside is Smurfette.

517
00:41:21,710 --> 00:41:31,470
So inside this method we are going to say get notification manager that notify notify.

518
00:41:31,480 --> 00:41:33,720
So first we need to pass the ID.

519
00:41:33,880 --> 00:41:42,030
We have the ID here we say notification Id come on and we need to pass the actual notification optics.

520
00:41:42,210 --> 00:41:44,970
So we have the notification builder here.

521
00:41:45,330 --> 00:41:47,160
So we say notification

522
00:41:49,970 --> 00:41:53,040
dot dot dot.

523
00:41:53,580 --> 00:42:00,030
So there reason we say notification builder here you are referring to the argument that built this build

524
00:42:00,030 --> 00:42:03,150
Meffert is going to return an object of type notification.

525
00:42:03,180 --> 00:42:09,420
So it's very important that we call the Budiman fit and this notification builder and we are going to

526
00:42:09,420 --> 00:42:14,100
see how it is implemented and how we can use this method in order to notify the user.

527
00:42:14,220 --> 00:42:17,910
But for now we need to implement this method like this.

528
00:42:17,910 --> 00:42:24,620
Now I think our class is done notification handler is actually finished now we need to go into that

529
00:42:24,670 --> 00:42:27,120
into the main activity class.

530
00:42:27,120 --> 00:42:29,450
So lets go and say this man I think the class here.

531
00:42:29,460 --> 00:42:32,030
So lets first run the application

532
00:42:34,850 --> 00:42:37,880
and here you can see that the app is running on the simulator.

533
00:42:38,030 --> 00:42:42,910
So we have an edit text here and we have two buttons right.

534
00:42:42,920 --> 00:42:47,360
First let's create an ID takes inside our main activity class.

535
00:42:47,360 --> 00:42:55,120
So lets say that we have private text and the name is going to be EDT.

536
00:42:55,220 --> 00:42:58,080
Watch movie semicolon.

537
00:42:58,510 --> 00:43:04,920
So now we need to go inside and create Meffert and we can say it it imma watch movie assignment operator.

538
00:43:05,050 --> 00:43:10,090
So here we don't cast to and edit text objects anymore.

539
00:43:10,420 --> 00:43:15,150
Before we had to manually just put up refractors and say edit text right.

540
00:43:15,190 --> 00:43:16,880
This is not necessary anymore.

541
00:43:16,900 --> 00:43:27,190
In the newest version of Android studio we can just say find the ID artist Id that EDT to watch movie

542
00:43:27,430 --> 00:43:29,260
semicolon OK.

543
00:43:29,590 --> 00:43:35,960
We also have two buttons post notification for movie and settings for movie notification.

544
00:43:36,220 --> 00:43:42,400
So we don't have to create a variable for a pattern and then initialize are valuable because we just

545
00:43:42,400 --> 00:43:48,860
want to make these buttons just listeners for the users clicks or taps.

546
00:43:49,090 --> 00:43:55,880
So we just say inside this and create method we just say find the way Id are that Id dot between.

547
00:43:56,170 --> 00:44:03,610
So for example we have this a billion watch movie that sets on click listener and we just pass the context

548
00:44:03,610 --> 00:44:07,070
which is this main activity that this.

549
00:44:07,600 --> 00:44:11,460
And we also have this one sentence for movie notification.

550
00:44:11,470 --> 00:44:25,440
So again we say find we will find the ID are taught ID dots between movie settings that set on click

551
00:44:25,440 --> 00:44:30,030
listener main activity that's this.

552
00:44:30,420 --> 00:44:39,810
And finally this main activity class must implement the IView dot on a quick lesson or interface and

553
00:44:39,960 --> 00:44:45,700
inside the class we need to override the on if it.

554
00:44:45,770 --> 00:44:47,300
So now the error is gone.

555
00:44:47,300 --> 00:44:50,140
And inside is actually effect let's create a switch statement.

556
00:44:50,150 --> 00:44:59,450
And let's switch between the values of the ID of the of view argument that is actually clicked inside

557
00:44:59,450 --> 00:45:00,620
the switch statement.

558
00:45:00,620 --> 00:45:11,420
We can we can have case that ID that PTEN watch movie Colan break and we have case on that idea that

559
00:45:11,600 --> 00:45:15,570
PTEN movie settings Colan break.

560
00:45:15,790 --> 00:45:22,450
OK so now we need to create some instance variables inside our main activity class.

561
00:45:22,520 --> 00:45:31,700
So let me create a comment ins and outs of variables Swon is going to be private and the name is going

562
00:45:31,700 --> 00:45:33,870
to be notification handler.

563
00:45:34,010 --> 00:45:39,770
So it is actually offtake notification handler handler and the name is that a vacation handler cynical.

564
00:45:39,770 --> 00:45:42,250
So this is the class that we created ourselves.

565
00:45:42,370 --> 00:45:48,950
When it going inside is uncreate Mefford and initialize this notification handler so assignment operator

566
00:45:49,400 --> 00:45:56,850
new notification handler and we need to pass the context which is going to be main activity that this

567
00:45:57,200 --> 00:45:58,880
OK semicolon.

568
00:45:59,370 --> 00:46:06,780
We also need to create an ID for the not reputation that we want to post to the users device.

569
00:46:06,780 --> 00:46:10,950
Notice that inside this notification handler class let me open it.

570
00:46:11,160 --> 00:46:13,620
We have an ID for that channel.

571
00:46:13,850 --> 00:46:14,630
OK.

572
00:46:14,940 --> 00:46:19,850
But inside the main activity class we want to have an ID for the notification.

573
00:46:20,130 --> 00:46:25,710
So if you are going to have two kinds of IDS the first kind is for that channel which is called Channel

574
00:46:25,710 --> 00:46:26,560
ID.

575
00:46:26,580 --> 00:46:29,890
The second one is notification ID.

576
00:46:29,940 --> 00:46:41,820
So inside its main activity class here I am going to say private static final INT and the name is going

577
00:46:41,820 --> 00:46:52,550
to be watch movie for each other like movie underline notification underline ID.

578
00:46:52,830 --> 00:46:58,070
OK not a challenge Id is the notification ID assignment operator.

579
00:46:58,060 --> 00:47:00,980
So it is like teacher and it must be a unique value.

580
00:47:01,000 --> 00:47:04,330
So just pass the value of 1000 to this constant.

581
00:47:04,330 --> 00:47:09,700
It doesn't really matter what value you assign to this constant but it must be unique.

582
00:47:09,700 --> 00:47:11,490
It has to be a unique value.

583
00:47:11,500 --> 00:47:20,620
Now we need to create a method called Post notification to users device and also inside this main activity

584
00:47:20,620 --> 00:47:30,010
class before the end in place of our main analytical s.a.a to say private voit and the name is going

585
00:47:30,010 --> 00:47:38,660
to be post notification to use your device and then put a pair of practices here so you know you're

586
00:47:38,750 --> 00:47:42,540
going to specify some parameters for this method.

587
00:47:42,950 --> 00:47:54,990
The first one is going to be in and the name is going to be notification I.D. notification ID comma

588
00:47:55,110 --> 00:48:02,120
and the second parameter is going to be off the strange and the name is going to be title text.

589
00:48:02,220 --> 00:48:08,690
So just open and close this method by using these curly braces inside the Smurfette to create a switch.

590
00:48:08,700 --> 00:48:16,400
They can switch and switch notification ID so just open and close the switch statements by using these

591
00:48:16,400 --> 00:48:17,310
curly braces.

592
00:48:17,570 --> 00:48:26,700
And we a case and as you can see inside this class we created an ID name as a watch moving notification

593
00:48:26,700 --> 00:48:27,380
ID.

594
00:48:27,750 --> 00:48:33,810
So we were going to see such moving notification Id call and if the ID of notification is watch moving

595
00:48:33,810 --> 00:48:37,790
notification ID then we can't say so before this.

596
00:48:37,790 --> 00:48:44,010
So it's they meant inside this post notification to use a device we need to create a local variable

597
00:48:44,700 --> 00:48:47,870
as a type a notification that builder.

598
00:48:48,090 --> 00:48:54,680
So they've been here notification that builder and the name is going to be notification there.

599
00:48:55,140 --> 00:49:00,240
And then initially we are going to assign the value gnarl to these local but semicolon.

600
00:49:00,840 --> 00:49:05,320
So we say case watch moving notification Id break.

601
00:49:05,400 --> 00:49:11,100
So let's go inside this case and let's say we just need to refer to our notification law litigation

602
00:49:11,100 --> 00:49:15,340
builder local variable and we're going to initialize it in this way.

603
00:49:15,450 --> 00:49:22,740
We have a variable on an instance variable named as notification handler right inside our main activity

604
00:49:22,740 --> 00:49:26,840
class here and we initialized it inside our uncreate method.

605
00:49:27,060 --> 00:49:36,010
So we're meant to refer to this notification handler instance variable not create and return watch moving

606
00:49:36,010 --> 00:49:40,870
notification so that we create a new line so that we can see what's going on here.

607
00:49:41,170 --> 00:49:45,370
So we need to pass some arguments to disprove it.

608
00:49:45,370 --> 00:49:52,300
Let me call this method again so that you can see what are the arguments that we're going to pass this.

609
00:49:52,540 --> 00:49:58,430
The first one is the title text and the second argument is going to be body text.

610
00:49:58,450 --> 00:50:02,650
So the for the title text we can say hateful text.

611
00:50:02,650 --> 00:50:09,400
So we already are dismembered posts santification to use a device has applied picture of type string

612
00:50:09,400 --> 00:50:13,130
and his name is title text so we just passed the title text to the Smurfette.

613
00:50:13,170 --> 00:50:14,450
Come on.

614
00:50:14,890 --> 00:50:16,560
And we have the body text.

615
00:50:16,600 --> 00:50:23,170
So the politics can be anything we can say for example of watch movie or this is a great movie.

616
00:50:23,170 --> 00:50:32,050
This is a great movie you can put whatever values that you want here.

617
00:50:32,080 --> 00:50:34,100
So just put a semicolon at the end of your statement.

618
00:50:34,160 --> 00:50:37,730
So after these suits they spent here.

619
00:50:37,790 --> 00:50:39,120
We have this ending.

620
00:50:39,140 --> 00:50:41,210
This is the end in curly brace of the sweet statement.

621
00:50:41,270 --> 00:50:47,790
After this any curly brace I am still inside this post notification to use a device Meffert and going

622
00:50:47,850 --> 00:50:59,090
to create to create an if statement so if notification builder is not equal to Knol or an invalid value

623
00:51:00,110 --> 00:51:01,410
this is not right.

624
00:51:01,410 --> 00:51:09,600
If it is not equal to all and this is actually the notification builder has a valid value then we can

625
00:51:09,600 --> 00:51:17,460
notify the user then we can say notification handler I am referring to my instance variable notification

626
00:51:17,460 --> 00:51:21,480
handler that notify the user.

627
00:51:21,690 --> 00:51:24,110
So we need to pass some arguments to this method.

628
00:51:24,330 --> 00:51:27,430
The first one is going to be the notification by D.

629
00:51:27,510 --> 00:51:32,340
So I want to say watch movie notification ID so it is capitalized.

630
00:51:32,340 --> 00:51:34,630
Watch movie notification Id come on.

631
00:51:35,040 --> 00:51:37,910
And finally 10:22 notification bill there.

632
00:51:38,220 --> 00:51:43,830
So we just passed the notification bill that we created inside site is post notification to user device

633
00:51:44,310 --> 00:51:45,170
Mefford.

634
00:51:45,610 --> 00:51:51,430
OK so this is the implementation of our post notification to use the device method.

635
00:51:51,450 --> 00:51:54,240
So here let me show you the emulator.

636
00:51:54,240 --> 00:51:59,370
So for example the use type something inside type something inside is added text.

637
00:51:59,400 --> 00:52:05,560
For example the name of the movie for example Star Wars right.

638
00:52:06,030 --> 00:52:12,950
And here the user clicks or taps on this post notification for movie bottom.

639
00:52:13,050 --> 00:52:16,050
You want something to happen so let's go back to the studio.

640
00:52:16,530 --> 00:52:23,640
And so does Uncle Smurfette in this case a statement or the idea that between the watch movie case we're

641
00:52:23,700 --> 00:52:28,130
going to say post notification to use their device.

642
00:52:28,130 --> 00:52:29,620
We're calling this method.

643
00:52:29,610 --> 00:52:32,170
So first we need to pass the notification ID.

644
00:52:32,520 --> 00:52:38,790
We already created the notification device moving notification Id come on and we need to pass this the

645
00:52:38,880 --> 00:52:40,160
total text.

646
00:52:40,350 --> 00:52:46,540
So we want the title IX to be the text of the text so we just refer to our editrix object.

647
00:52:46,560 --> 00:52:52,510
EDT provides movie that get mixed dots.

648
00:52:52,530 --> 00:52:57,930
This is very important to think Mini-Cooper converted to a string value because they get text Leffert

649
00:52:58,710 --> 00:53:01,560
returns an object of type editable.

650
00:53:01,560 --> 00:53:07,350
So if you want to learn more about this you can actually take a look at the documentation or you can

651
00:53:07,350 --> 00:53:11,590
just click on this get text message hold on the comment on your keyboard and then click on this get

652
00:53:11,630 --> 00:53:12,610
text Meffert.

653
00:53:12,720 --> 00:53:17,080
If youre using a Windows machine you can actually take a look at.

654
00:53:17,160 --> 00:53:21,810
You can hold the control key and then click on this Meffert you know that it actually takes a look at

655
00:53:21,810 --> 00:53:26,590
the implementation of this mephitic and see that the return type of this method is actually editable.

656
00:53:26,790 --> 00:53:28,010
So let me click.

657
00:53:28,120 --> 00:53:29,340
Close this file.

658
00:53:29,700 --> 00:53:31,440
Now let me create a new line here.

659
00:53:31,440 --> 00:53:36,300
So let's run tiap let's run the app and let's see what happens.

660
00:53:36,720 --> 00:53:40,440
Let me show you the emulator so I'm going to enter the name of the movie.

661
00:53:40,740 --> 00:53:47,490
So the name of the movie is for example Star Wars and I'm going to click on this post notification for

662
00:53:47,490 --> 00:53:48,000
the movie.

663
00:53:48,030 --> 00:53:54,660
So as you can see here it doesn't create a notification of for our Android application.

664
00:53:54,660 --> 00:53:57,180
So there is a bug inside our app.

665
00:53:57,360 --> 00:53:57,940
OK.

666
00:53:58,200 --> 00:53:59,540
We need to find the park.

667
00:53:59,910 --> 00:54:01,470
There are two ways to find the park.

668
00:54:01,470 --> 00:54:08,190
You can use the debugging tools or you can actually just simply take a look at your node notification

669
00:54:08,190 --> 00:54:15,110
handler class and say this notification handler class you can see that we have this method in our grey

670
00:54:15,110 --> 00:54:15,960
color.

671
00:54:16,260 --> 00:54:22,160
If I hover over this if it says Meffert create notification channel is never used.

672
00:54:22,170 --> 00:54:27,030
This means that we haven't called this method from anywhere.

673
00:54:27,270 --> 00:54:31,620
We need to call this create artificial channel so that notification channel is created.

674
00:54:31,630 --> 00:54:38,540
Remember I told you that for Android 8 or audio we must create a notification channel.

675
00:54:38,710 --> 00:54:40,130
Otherwise it doesn't.

676
00:54:40,170 --> 00:54:43,860
It's not going to create a notification for the user device.

677
00:54:44,280 --> 00:54:46,400
So we need to call the notification.

678
00:54:46,470 --> 00:54:54,000
Vinita call the Create vacation channel inside a constructor of this notification handler class.

679
00:54:54,180 --> 00:55:02,350
So after calling the super constructor we are going to say create notification turnon that's it.

680
00:55:02,360 --> 00:55:05,510
Now we can run the application.

681
00:55:05,590 --> 00:55:07,080
Let me show you the emulator.

682
00:55:07,240 --> 00:55:12,750
So inside these edits I'm going to just step in here Star Wars.

683
00:55:12,920 --> 00:55:16,570
Now I'm going to click on this post notification for a movie.

684
00:55:16,850 --> 00:55:20,000
As you can see there was a sad.

685
00:55:20,140 --> 00:55:21,810
I think you heard the sound.

686
00:55:21,950 --> 00:55:28,420
And we have the notification here if I show you the notifications you can see that it says Star Wars.

687
00:55:28,550 --> 00:55:31,070
You can see this movie icon.

688
00:55:31,070 --> 00:55:35,190
This is the name of the app and it says this is a great movie.

689
00:55:35,390 --> 00:55:36,460
Right.

690
00:55:36,470 --> 00:55:40,290
So now I want to talk about this one.

691
00:55:40,290 --> 00:55:45,920
These settings for the movie notification if you want to make this one work so that whenever the user

692
00:55:45,920 --> 00:55:54,570
clicks on this button it's going to open up the settings application of the user's device and it's going

693
00:55:54,570 --> 00:56:00,390
to open the settings page for this application for this notification actually.

694
00:56:00,680 --> 00:56:06,390
So each application has a notification settings.

695
00:56:06,620 --> 00:56:08,360
So let me tell you that.

696
00:56:08,480 --> 00:56:14,440
Let me show you the application So for example we have this app in C at right e-filed launch.

697
00:56:14,660 --> 00:56:22,970
Click this app or if I select and hold this up for a moment here as you can see I just alone clicked

698
00:56:23,030 --> 00:56:23,600
this app.

699
00:56:23,690 --> 00:56:28,390
And as you can see it this app actually let all the dialog is opened.

700
00:56:28,400 --> 00:56:30,190
For us it is Star Wars.

701
00:56:30,200 --> 00:56:35,930
This is the great movie notifications if we click on it here if we click on this notifications as you

702
00:56:35,930 --> 00:56:37,250
can see nothing happened.

703
00:56:37,250 --> 00:56:39,190
But it is app info.

704
00:56:39,310 --> 00:56:45,380
If I click on this app info you can see this is our application so you can open your settings application

705
00:56:45,380 --> 00:56:52,220
inside your app inside your device and then click on settings and then click on the apps and then you

706
00:56:52,220 --> 00:56:58,640
can see for example your apps there if we click on a specific application you can see up activity like

707
00:56:58,640 --> 00:57:01,160
this one on Istar for stop.

708
00:57:01,310 --> 00:57:03,440
And here we have app notifications.

709
00:57:03,440 --> 00:57:09,830
If I click on it you can see it is on the notification is on if I actually make this up.

710
00:57:09,970 --> 00:57:15,380
It's going on notifications for this application is going to be off and it's not going to create notifications

711
00:57:15,380 --> 00:57:17,370
for this application.

712
00:57:17,960 --> 00:57:20,780
And here we have the categories right.

713
00:57:20,960 --> 00:57:23,670
Darby You m in C name.

714
00:57:24,050 --> 00:57:29,110
So if I click on it this is the notification channel the category's is the channel.

715
00:57:29,210 --> 00:57:33,990
If I click on this one here you can see the attributes of our channel.

716
00:57:34,100 --> 00:57:40,790
So if we go into this android studio you can see if like when we created the notification turned on

717
00:57:40,790 --> 00:57:43,930
here you can see these attributes that we specify here.

718
00:57:43,930 --> 00:57:47,060
So for example the id the name the importance.

719
00:57:47,180 --> 00:57:51,410
So here you can see that it says the importance is high it make sound.

720
00:57:51,410 --> 00:57:54,140
We have urgent medium low.

721
00:57:54,350 --> 00:58:02,290
So I just use the default so the default is high on it and it does create a sound like select this one

722
00:58:02,360 --> 00:58:11,880
urgent make sound and pop on a screen so that if this one let's go back go back and back.

723
00:58:11,900 --> 00:58:19,040
So let's open our application let's this time just change the name of the movie to for example mask

724
00:58:20,680 --> 00:58:26,530
and let's click on post notification for a movie as you can see the sound and there that a vacation

725
00:58:26,530 --> 00:58:27,520
pops on the screen.

726
00:58:27,580 --> 00:58:30,090
This is a great movie right.

727
00:58:30,190 --> 00:58:32,360
So let's.

728
00:58:32,370 --> 00:58:41,110
So here I created this spot here in order to guide the user directly to the citizens of this specific

729
00:58:41,110 --> 00:58:46,870
notification channel so that the user can actually just easily change the settings.

730
00:58:46,870 --> 00:58:52,480
For example change the importance or whatever that is related to this channel.

731
00:58:52,870 --> 00:58:54,960
But here are there is an exception here.

732
00:58:55,030 --> 00:59:01,790
Here I want to show you that when you code it in notification channels for example here we specified

733
00:59:01,810 --> 00:59:02,070
there.

734
00:59:02,070 --> 00:59:06,340
Watch the importance to be default for this notification.

735
00:59:06,370 --> 00:59:07,160
Right.

736
00:59:07,390 --> 00:59:13,570
But when the app runs and when you create the notification then of which if it actually for example

737
00:59:13,570 --> 00:59:18,430
changed this importance default to importance to low.

738
00:59:18,440 --> 00:59:19,140
So let's change it.

739
00:59:19,130 --> 00:59:24,690
Importance to for example here is not going to affect how our notification of this apple.

740
00:59:24,710 --> 00:59:30,170
So let's run the app because if we changed the settings in say the settings of the notification.

741
00:59:30,170 --> 00:59:37,580
So for example let's give it a name for example against Starforce and ask recomposed not a vacation.

742
00:59:37,620 --> 00:59:40,940
As you can see now this notification pops on the screen.

743
00:59:40,950 --> 00:59:48,720
But here I sit important slow so it doesn't affect how or how our notification works when you change

744
00:59:48,750 --> 00:59:50,630
the settings inside the settings.

745
00:59:50,640 --> 00:59:58,160
Activity of this notification that specific settings is what matters here.

746
00:59:58,340 --> 00:59:59,380
OK.

747
00:59:59,970 --> 1:00:05,370
When you change the code it doesn't affect it because the user has already changed the settings of the

748
1:00:05,370 --> 1:00:08,250
notification inside the settings application.

749
1:00:08,250 --> 1:00:15,900
So here we want to create a way for the user to access the notifications directly by just clicking on

750
1:00:15,900 --> 1:00:16,610
the spot.

751
1:00:17,010 --> 1:00:21,990
Let's scoot into our Android studio and let's go inside the main activity class and let's see how we

752
1:00:21,990 --> 1:00:22,950
can do that.

753
1:00:22,970 --> 1:00:23,300
OK.

754
1:00:23,310 --> 1:00:25,260
So inside is main activity class.

755
1:00:25,260 --> 1:00:26,700
Let's scroll down here.

756
1:00:26,730 --> 1:00:30,860
So before the end in curly brace our main activity class we are going to create a method.

757
1:00:31,110 --> 1:00:37,680
So it is going to be private and that the return type is going to be void in name is going to be open

758
1:00:38,370 --> 1:00:46,340
notification notification settings.

759
1:00:46,430 --> 1:00:51,710
What movie channel.

760
1:00:51,920 --> 1:00:57,620
So let's put up pair of here and let's provide a privater of types 3:47.

761
1:00:57,690 --> 1:01:09,020
So it is going to be a tape strange and the name is going to be watch movie channel.

762
1:01:09,230 --> 1:01:12,890
So let's open and close this method by using these curly braces.

763
1:01:13,550 --> 1:01:19,700
So here first we need to create an intense object so intent and the name is going to be set Henning's

764
1:01:20,150 --> 1:01:30,360
intent assignment operator new intent to specify the type of the settings activity that we want to open.

765
1:01:30,380 --> 1:01:34,730
We want to open the notification settings for the watch movie channel.

766
1:01:34,760 --> 1:01:35,440
Right.

767
1:01:35,510 --> 1:01:46,430
So we're going to say cities with capital S dot on here we need to specify the type of the activity

768
1:01:46,850 --> 1:01:49,380
settings the activity that we want to open.

769
1:01:49,400 --> 1:01:53,720
The name is action.

770
1:01:53,880 --> 1:02:01,230
So I'm going to just type it he had manually action underly channel action on the line

771
1:02:04,190 --> 1:02:07,500
channel notification settings.

772
1:02:07,850 --> 1:02:10,570
So this is the type of activity that we want to open.

773
1:02:10,730 --> 1:02:12,940
Action channel notification settings.

774
1:02:13,100 --> 1:02:22,510
But we must specify that we want to open the notification channel of the watch movie actually channel.

775
1:02:22,670 --> 1:02:27,210
So if we are going to specify some extras for this intent.

776
1:02:27,420 --> 1:02:34,560
So first we're going to send the package the package name of our application to this intent because

777
1:02:34,560 --> 1:02:41,550
you want to specify that this is our application and we want to open the notification channel for our

778
1:02:41,550 --> 1:02:42,660
own application.

779
1:02:42,870 --> 1:02:48,400
So we are going to say setting's intent that puts extra.

780
1:02:48,550 --> 1:02:57,880
And here we need to specify the name or the key into say sittings with capital as that extra package

781
1:02:58,540 --> 1:03:04,490
come on and we need to send the value into past the actual value.

782
1:03:04,510 --> 1:03:07,240
So if you're going to just say just package any

783
1:03:10,350 --> 1:03:20,820
package simply call the Vini to send and other extras going to the settings intent that put extra sittings

784
1:03:22,000 --> 1:03:26,690
settings that extra channel Id come on.

785
1:03:26,710 --> 1:03:33,130
So here we already created a prime meter for this watch movie channel ID.

786
1:03:33,160 --> 1:03:37,440
So let's change the name of this primetime to watch movie channel ID.

787
1:03:37,780 --> 1:03:42,210
And then here we just need to pass it as an argument to this put extra effort.

788
1:03:42,220 --> 1:03:52,180
So we just say watch movie channel ID and then we are going to actually say start activity and we just

789
1:03:52,180 --> 1:03:53,600
passed the internet settings.

790
1:03:53,740 --> 1:03:54,840
Intent OK.

791
1:03:55,150 --> 1:04:01,210
So now we need to scroll through it so you can see that these are created if you already created an

792
1:04:01,240 --> 1:04:06,550
unexpected close enough for this PTEN movie City movie settings button and inside this enclave we have

793
1:04:06,550 --> 1:04:09,300
a case for this one for this between movie settings.

794
1:04:09,310 --> 1:04:15,700
So we are going to just call this Meffert open notification settings for watch movie channel and we

795
1:04:15,700 --> 1:04:17,260
just need to pass the ID.

796
1:04:17,290 --> 1:04:22,390
The ID is notification handlers so we are referring to this question handler class.

797
1:04:22,570 --> 1:04:30,850
And if you remember this notification handler class we actually declared this ID as static.

798
1:04:30,850 --> 1:04:31,160
Right.

799
1:04:31,180 --> 1:04:39,430
This means that by just accessing the notification class we can access this constant because it is public

800
1:04:39,490 --> 1:04:40,580
static.

801
1:04:40,900 --> 1:04:45,020
So it is a class variable or a constant thats going to say this may not have the class.

802
1:04:45,280 --> 1:04:51,190
And here we say notification handler that I just got a token here ID and here it is the watch moving

803
1:04:51,190 --> 1:04:53,160
notification channel ID.

804
1:04:53,320 --> 1:04:57,270
So let me create a new line here so that we can see what's going on here.

805
1:04:57,460 --> 1:05:01,350
Let's run the app and let's see what's going to happen.

806
1:05:01,420 --> 1:05:03,630
So we just need to enter the name of the movie.

807
1:05:03,640 --> 1:05:10,620
So we just see Star Wars and here I'm going to first I'm going to test that positive action for movie

808
1:05:10,630 --> 1:05:11,460
works.

809
1:05:11,740 --> 1:05:12,760
So it works.

810
1:05:12,760 --> 1:05:17,630
You can see literally kind of settings for a movie for movie notification.

811
1:05:17,630 --> 1:05:21,050
And here it is the settings for this application.

812
1:05:21,090 --> 1:05:24,470
Here it is the name it is on importance.

813
1:05:24,490 --> 1:05:30,660
We have urgent high medium low and we have a vibrate.

814
1:05:30,820 --> 1:05:33,210
We have advanced notification.

815
1:05:33,700 --> 1:05:34,380
So that's it.

816
1:05:34,420 --> 1:05:37,170
Our application works fine and perfectly.

817
1:05:37,570 --> 1:05:43,390
So I think that's enough for the story all in in the next application the next tutorial we're going

818
1:05:43,390 --> 1:05:47,470
to start creating another app about notifications.

819
1:05:47,470 --> 1:05:54,540
But this time our application is going to target versions before the Android 8 or Orio.

820
1:05:55,030 --> 1:05:57,800
And you're going to see how it is implemented.

821
1:05:58,090 --> 1:06:04,330
And again if you want to create your own application inside your app you should differentiate between

822
1:06:04,750 --> 1:06:10,640
the Android API eyes before Android 8 and the Android 8 or above.

823
1:06:10,930 --> 1:06:17,530
If you want to learn about a differentiating API using Android you can actually take a look at the some

824
1:06:17,530 --> 1:06:19,960
of the applications that you have created in this course.

825
1:06:19,990 --> 1:06:27,970
The one that I remember now is the floating view application that I actually uploaded into the section.

826
1:06:28,030 --> 1:06:33,770
I think the last section of the course the name of the section is requested apps.

827
1:06:33,820 --> 1:06:35,850
So thank you very much for watching.

828
1:06:35,860 --> 1:06:41,320
If you have any questions about these concepts that I've taught you so far please post a discussion

829
1:06:41,320 --> 1:06:44,690
in the course and then I will do my best to answer all of your questions.

830
1:06:44,950 --> 1:06:47,650
And I look forward to seeing you in the next tutorial.

