1
00:00:00,170 --> 00:00:03,670
(light electronic jingle)

2
00:00:05,320 --> 00:00:07,170
Alright, so in the previous video,

3
00:00:07,170 --> 00:00:10,530
we saw how our app will handle the situation

4
00:00:10,530 --> 00:00:12,550
where the user denies permissions.

5
00:00:12,550 --> 00:00:14,310
If they just deny the permission,

6
00:00:14,310 --> 00:00:16,500
then we can request access again

7
00:00:16,500 --> 00:00:18,370
when they next try to perform the function

8
00:00:18,370 --> 00:00:20,730
that needs the permission, viewing the contact

9
00:00:20,730 --> 00:00:22,390
details in this case.

10
00:00:22,390 --> 00:00:24,750
If the user denies the permission and ticks the box

11
00:00:24,750 --> 00:00:27,320
saying they don't want to be asked again,

12
00:00:27,320 --> 00:00:29,970
our app then takes them for the settings for the app

13
00:00:29,970 --> 00:00:31,490
so that they can tap the permissions

14
00:00:31,490 --> 00:00:34,210
and grant the access that our app needs.

15
00:00:34,210 --> 00:00:36,660
So we've got a good solution now.

16
00:00:36,660 --> 00:00:38,610
And remember we used a snackbar to display

17
00:00:38,610 --> 00:00:41,030
the message to the user and also to provide

18
00:00:41,030 --> 00:00:43,110
them with a link they could tap

19
00:00:43,110 --> 00:00:45,173
to go ahead and grant the permission.

20
00:00:45,173 --> 00:00:48,060
A snackbar is limited to two lines of text,

21
00:00:48,060 --> 00:00:50,490
so there's not very much information you can provide

22
00:00:50,490 --> 00:00:51,360
to the user.

23
00:00:51,360 --> 00:00:53,170
If you do want to give them a more detailed

24
00:00:53,170 --> 00:00:56,650
explanation of why the app needs a particular permission,

25
00:00:56,650 --> 00:00:58,700
then you may be better off using a dialogue box

26
00:00:58,700 --> 00:01:00,570
rather than a snackbar.

27
00:01:00,570 --> 00:01:02,580
The principle is exactly the same though,

28
00:01:02,580 --> 00:01:04,790
so let's continue with our example app

29
00:01:04,790 --> 00:01:06,789
so you see now how to proceed

30
00:01:06,789 --> 00:01:09,320
when that permission is denied.

31
00:01:09,320 --> 00:01:11,760
So that needs to do one of two things

32
00:01:11,760 --> 00:01:14,470
when it detects that the permission hasn't been granted.

33
00:01:14,470 --> 00:01:17,040
It either needs to request the permission or it needs

34
00:01:17,040 --> 00:01:19,880
to take the user to the apps settings.

35
00:01:19,880 --> 00:01:22,060
Now both of these tasks are really simple.

36
00:01:22,060 --> 00:01:24,140
We've already seen how to request the permission

37
00:01:24,140 --> 00:01:26,270
using the request permissions method,

38
00:01:26,270 --> 00:01:28,510
and launching the app setting screen is done

39
00:01:28,510 --> 00:01:30,817
using an intent and the start activity method

40
00:01:30,817 --> 00:01:32,890
that we've seen before.

41
00:01:32,890 --> 00:01:34,470
The tricky bit though is working out

42
00:01:34,470 --> 00:01:36,360
which task to perform.

43
00:01:36,360 --> 00:01:38,332
So how can we tell if the user had permanently

44
00:01:38,332 --> 00:01:41,110
denied the permission by ticking the box

45
00:01:41,110 --> 00:01:44,090
or just tapped deny in the dialogue.

46
00:01:44,090 --> 00:01:46,283
But it turns out that it isn't very difficult at all.

47
00:01:46,283 --> 00:01:48,340
Google have thought about this

48
00:01:48,340 --> 00:01:50,660
and they provide a method with the catchy name,

49
00:01:50,660 --> 00:01:54,930
wait for it, Should Show Request Permissions Rationale.

50
00:01:54,930 --> 00:01:57,100
So we're going to use that in our action code

51
00:01:57,100 --> 00:01:59,120
instead of just showing the toast message

52
00:01:59,120 --> 00:02:00,720
as it does at the moment.

53
00:02:00,720 --> 00:02:02,420
So I'll type this code in and then we'll go through

54
00:02:02,420 --> 00:02:03,870
it and explain what it does.

55
00:02:03,870 --> 00:02:05,820
First we're gonna start off by changing the text

56
00:02:05,820 --> 00:02:07,380
that the user will click,

57
00:02:07,380 --> 00:02:09,443
in other words, the action text itself.

58
00:02:10,990 --> 00:02:13,760
Alright, so what we want to do first is I'm gonna

59
00:02:13,760 --> 00:02:16,060
change the code, the text rather,

60
00:02:16,060 --> 00:02:19,310
that's shown on the screen that the user will click on,

61
00:02:19,310 --> 00:02:22,143
the action text, gonna change that to say grant access.

62
00:02:24,390 --> 00:02:26,580
Then within the code that's gonna be executed

63
00:02:26,580 --> 00:02:29,180
when that's tapped, I'm gonna start with a log entry,

64
00:02:29,180 --> 00:02:31,560
log.d TAG comma

65
00:02:31,560 --> 00:02:35,743
snackbar onClick starts.

66
00:02:37,350 --> 00:02:38,940
Then we're going to add an if here.

67
00:02:38,940 --> 00:02:43,592
If parenthesis, then it's ActivityCompat dot

68
00:02:43,592 --> 00:02:46,573
Should Show Request Permission Rationale.

69
00:02:47,460 --> 00:02:50,603
And in parenthesis, this comma READ_CONTACTS.

70
00:02:53,670 --> 00:02:55,430
So I'm going to close off those bracers

71
00:02:55,430 --> 00:02:57,047
then open a code block.

72
00:02:58,000 --> 00:02:59,410
And in the else, for now I'm just going

73
00:02:59,410 --> 00:03:01,380
to make that an empty else, and I'm going to delete

74
00:03:01,380 --> 00:03:02,513
the toast message.

75
00:03:03,730 --> 00:03:05,777
And within the first if there what I'm going to do

76
00:03:05,777 --> 00:03:10,777
is put log.d parenthesis TAG comma,

77
00:03:10,840 --> 00:03:14,643
and it's going to be snackbar onClick

78
00:03:14,643 --> 00:03:17,873
calling request permissions.

79
00:03:21,445 --> 00:03:24,210
And just to be consistent I'll change that.

80
00:03:24,210 --> 00:03:26,550
What I'm gonna do is copy the line of code here

81
00:03:26,550 --> 00:03:30,010
from line 38, because we're gonna be executing

82
00:03:30,010 --> 00:03:32,610
that exact code and that's gonna be pasted

83
00:03:32,610 --> 00:03:35,083
immediately below that log in there.

84
00:03:36,907 --> 00:03:38,690
And just so we can read that I'm gonna put that

85
00:03:38,690 --> 00:03:40,090
onto the next line.

86
00:03:40,997 --> 00:03:44,400
And that's also below the else, put a log in there,

87
00:03:44,400 --> 00:03:49,400
log.d parenthesis TAG comma snackbar onClick ends.

88
00:03:51,571 --> 00:03:53,530
Just so we're clear what's happened there.

89
00:03:53,530 --> 00:03:54,900
Alright, so what have we done here?

90
00:03:54,900 --> 00:03:57,649
Well you saw me add some logging firstly on line 64

91
00:03:57,649 --> 00:04:00,050
so that we can see the snackbar's

92
00:04:00,050 --> 00:04:01,565
onClick method being called.

93
00:04:01,565 --> 00:04:05,150
Then we're calling, Should Show Request Permission Rationale

94
00:04:05,150 --> 00:04:08,500
on line 65, then we're testing to see if it returns

95
00:04:08,500 --> 00:04:10,270
true or false.

96
00:04:10,270 --> 00:04:12,270
Now I'll explain that method next

97
00:04:12,270 --> 00:04:14,100
but if it just returns true,

98
00:04:14,100 --> 00:04:16,640
then we just, in this case we're going to log

99
00:04:16,640 --> 00:04:19,209
that entry and then we're going to call this method

100
00:04:19,209 --> 00:04:21,980
to request the permissions again as we've done previously.

101
00:04:21,980 --> 00:04:23,340
So that's pretty simple.

102
00:04:23,340 --> 00:04:26,402
If it returns false though, we're gonna take the user

103
00:04:26,402 --> 00:04:29,120
into the settings page for the app,

104
00:04:29,120 --> 00:04:30,700
so let's actually have a look and see what this method's

105
00:04:30,700 --> 00:04:33,078
all about, so I'm going to just click on that

106
00:04:33,078 --> 00:04:34,473
and bring up the documentation.

107
00:04:37,310 --> 00:04:40,490
Now this method is in the compatibility support library

108
00:04:40,490 --> 00:04:45,460
in the package Android.support.v4.app.activityCompat.

109
00:04:45,460 --> 00:04:47,580
So we can use it in the code that's intended to run

110
00:04:47,580 --> 00:04:49,800
on Android versions before Marshmallow.

111
00:04:49,800 --> 00:04:51,260
Now you might be wondering why we don't

112
00:04:51,260 --> 00:04:53,510
just use the framework version

113
00:04:53,510 --> 00:04:55,600
because this method will never be called if the app

114
00:04:55,600 --> 00:04:58,070
is running on APR22 or earlier.

115
00:04:58,070 --> 00:05:00,210
But the code might compile if I try to use

116
00:05:00,210 --> 00:05:04,120
the framework version when my minimum SDK is less than 23,

117
00:05:04,120 --> 00:05:06,660
hence the reason for using the compat version.

118
00:05:06,660 --> 00:05:09,900
And just to check that, what we can do is we can

119
00:05:09,900 --> 00:05:11,400
just take a copy of that line,

120
00:05:12,510 --> 00:05:17,510
temporarily comment out that line and change this

121
00:05:18,020 --> 00:05:20,130
removing the activity compact,

122
00:05:20,130 --> 00:05:22,062
and you can see we've got an error there.

123
00:05:22,062 --> 00:05:26,493
Core requires APR level 23, current minimum is 17.

124
00:05:27,475 --> 00:05:29,040
By the way that's something I do recommend you do

125
00:05:29,040 --> 00:05:31,513
if you want to test out something like this.

126
00:05:33,320 --> 00:05:36,040
Duplicate the line of code and then go ahead

127
00:05:36,040 --> 00:05:38,098
and actually check it and you've still got

128
00:05:38,098 --> 00:05:39,270
your original code to go back to.

129
00:05:39,270 --> 00:05:41,590
Alright, so I've done that as you can see there.

130
00:05:41,590 --> 00:05:43,910
So Android Studio basically warned us that the code

131
00:05:43,910 --> 00:05:46,880
wouldn't compile unless we set the minimum SDK

132
00:05:46,880 --> 00:05:49,550
to APR23 or higher, hence the reason that I'm using

133
00:05:49,550 --> 00:05:52,110
the activity compat or the compat version

134
00:05:52,110 --> 00:05:54,850
that supports versions earlier than Marshmallow.

135
00:05:54,850 --> 00:05:57,973
So this method should show request permission rationale.

136
00:06:00,870 --> 00:06:03,480
It's used to decide if we should show some sort of user

137
00:06:03,480 --> 00:06:07,280
interface to the user explaining why we need the permission.

138
00:06:07,280 --> 00:06:09,810
So the methods intended to be used as the documentation

139
00:06:09,810 --> 00:06:12,370
says only if you do not have the permission

140
00:06:12,370 --> 00:06:15,340
and the context in which the permission is requested

141
00:06:15,340 --> 00:06:18,560
does not clearly communicate to the user what would

142
00:06:18,560 --> 00:06:21,310
be the benefit from granting this permission.

143
00:06:21,310 --> 00:06:23,250
So I guess that sort of implies that we shouldn't

144
00:06:23,250 --> 00:06:25,910
be using it, because that is pretty obvious already

145
00:06:25,910 --> 00:06:28,110
why our contacts app needs to access

146
00:06:28,110 --> 00:06:30,410
the phones contacts database.

147
00:06:30,410 --> 00:06:33,320
It may be obvious but equally obviously

148
00:06:33,320 --> 00:06:35,970
if the user has denied access then we do need

149
00:06:35,970 --> 00:06:38,870
to prompt them in some way, so don't take that comment

150
00:06:38,870 --> 00:06:41,550
as a rule that it must be obeyed no matter what.

151
00:06:41,550 --> 00:06:43,180
Treat it as a guide.

152
00:06:43,180 --> 00:06:45,650
So here in our case, we need to do something

153
00:06:45,650 --> 00:06:47,970
if they can't access the database,

154
00:06:47,970 --> 00:06:50,233
and if that involves misusing this very useful method

155
00:06:50,233 --> 00:06:51,940
then so be it.

156
00:06:51,940 --> 00:06:54,180
One thing lacking from this documentation

157
00:06:54,180 --> 00:06:57,020
is what the returned value signifies.

158
00:06:57,020 --> 00:06:58,710
It just really says whether you can use the

159
00:06:58,710 --> 00:07:02,590
Show Permission Rationale UI so you get a true or false,

160
00:07:02,590 --> 00:07:06,030
but there's no real indication there of why.

161
00:07:06,030 --> 00:07:08,920
Now unfortunately you can't check the source code

162
00:07:08,920 --> 00:07:11,260
to find out what's going on because it eventually

163
00:07:11,260 --> 00:07:14,210
ends up calling a method on the abstract package

164
00:07:14,210 --> 00:07:17,890
manager class and abstract methods don't have source code.

165
00:07:17,890 --> 00:07:19,150
So the documentation we've been

166
00:07:19,150 --> 00:07:21,950
using though is quite informative.

167
00:07:21,950 --> 00:07:24,233
Now I'm just gonna bring that link up on the screen again.

168
00:07:30,750 --> 00:07:32,440
That's quite informative as I said, but unfortunately

169
00:07:32,440 --> 00:07:34,650
it's changed now and it's actually

170
00:07:34,650 --> 00:07:36,170
a little bit less informative.

171
00:07:36,170 --> 00:07:38,090
Now come over here we've got this, in our contents,

172
00:07:38,090 --> 00:07:39,820
explain why the app needs permissions.

173
00:07:39,820 --> 00:07:42,730
If I click on that, that actually describes

174
00:07:42,730 --> 00:07:46,031
the behaviour, you can see on the screen there now.

175
00:07:46,031 --> 00:07:48,720
Basically describes the behaviour of the show,

176
00:07:48,720 --> 00:07:51,770
Should Show Request Permission Rationale.

177
00:07:51,770 --> 00:07:53,120
Now it used to have this notice

178
00:07:53,120 --> 00:07:55,210
which I'll bring on the screen.

179
00:07:55,210 --> 00:07:56,920
But that note's now been removed.

180
00:07:56,920 --> 00:07:59,090
The behaviour hasn't changed, and we've got to rely

181
00:07:59,090 --> 00:08:02,090
on that false return value in our code.

182
00:08:02,090 --> 00:08:04,660
Now we've locked a documentation issue with Google

183
00:08:04,660 --> 00:08:06,510
so the note may well be back by the time

184
00:08:06,510 --> 00:08:07,810
you visit this site again.

185
00:08:08,820 --> 00:08:10,170
So we've established at this point

186
00:08:10,170 --> 00:08:12,510
that the method will return true

187
00:08:12,510 --> 00:08:15,010
if the user has previously denied the request

188
00:08:15,010 --> 00:08:17,520
which is what we want here because we want to ask

189
00:08:17,520 --> 00:08:19,051
them again to grant access.

190
00:08:19,051 --> 00:08:22,970
Rather cleverly, it will allow false if the user

191
00:08:22,970 --> 00:08:24,796
has chosen the don't ask again option

192
00:08:24,796 --> 00:08:26,810
by ticking the box.

193
00:08:26,810 --> 00:08:28,510
So that means it provides a way to tell

194
00:08:28,510 --> 00:08:30,750
if the user has just denied the request,

195
00:08:30,750 --> 00:08:33,789
will get true returned or if they tick the box,

196
00:08:33,789 --> 00:08:35,440
in that case we'll get false.

197
00:08:35,440 --> 00:08:38,080
Now we have to be a bit careful and don't just go

198
00:08:38,080 --> 00:08:40,110
calling this method all over the place,

199
00:08:40,110 --> 00:08:42,450
because it will also return false

200
00:08:42,450 --> 00:08:44,430
if we already have the permission.

201
00:08:44,430 --> 00:08:46,340
And that makes sense if you think about it,

202
00:08:46,340 --> 00:08:48,170
if the user has granted permission,

203
00:08:48,170 --> 00:08:51,120
then there's no point explaining to them why the need it.

204
00:08:51,120 --> 00:08:52,910
So once you've checked and discovered that your app

205
00:08:52,910 --> 00:08:54,890
doesn't have the permission though,

206
00:08:54,890 --> 00:08:57,290
this method lets you decide whether you can just

207
00:08:57,290 --> 00:08:59,730
ask again or you need to do more,

208
00:08:59,730 --> 00:09:01,842
such as taking them in our case to the settings

209
00:09:01,842 --> 00:09:04,470
or perhaps displaying a dialogue with more information

210
00:09:04,470 --> 00:09:06,450
or whatever you need to do.

211
00:09:06,450 --> 00:09:08,980
So if you're writing apps for the corporate world

212
00:09:08,980 --> 00:09:10,630
where the app will be running on devices

213
00:09:10,630 --> 00:09:13,451
that are centrally controlled by a company's IT department,

214
00:09:13,451 --> 00:09:15,842
then you would have to be a bit more careful.

215
00:09:15,842 --> 00:09:18,410
That's because the Should Show Request Permission

216
00:09:18,410 --> 00:09:21,470
Rationale method will return false if the IT

217
00:09:21,470 --> 00:09:25,010
department had deployed a policy permitting users

218
00:09:25,010 --> 00:09:27,060
from granting the permission you need.

219
00:09:27,060 --> 00:09:29,700
So in that scenario, taking them into the settings

220
00:09:29,700 --> 00:09:32,610
is futile, but we're not covering device policies

221
00:09:32,610 --> 00:09:35,120
in this course, but it is useful just to be aware

222
00:09:35,120 --> 00:09:38,980
of that comment if you do end up producing corporate apps.

223
00:09:38,980 --> 00:09:41,990
Alright, so let's go back to Android Studio.

224
00:09:41,990 --> 00:09:44,050
So we shouldn't have got back to this bit of code

225
00:09:44,050 --> 00:09:46,542
in the first place unless permission was denied.

226
00:09:46,542 --> 00:09:49,240
And we've now checked and discovered that the permission

227
00:09:49,240 --> 00:09:52,470
has only been denied, not permanently denied.

228
00:09:52,470 --> 00:09:55,170
And that's the way that the activity compat

229
00:09:55,170 --> 00:09:57,110
Should Show Request Permission Rationale

230
00:09:57,110 --> 00:09:59,350
method returning true.

231
00:09:59,350 --> 00:10:01,300
So therefore, you saw that I just pasted in

232
00:10:01,300 --> 00:10:03,820
the same code we used earlier to request

233
00:10:03,820 --> 00:10:05,310
permission from the user again.

234
00:10:05,310 --> 00:10:07,270
So hopefully at this point now that they've seen

235
00:10:07,270 --> 00:10:09,440
our snackbar message when trying to display

236
00:10:09,440 --> 00:10:11,857
the phone's contacts, they'll grant access.

237
00:10:11,857 --> 00:10:16,405
So that's if it returned true, but if the method

238
00:10:16,405 --> 00:10:19,020
returns false, this is the Should Show Request

239
00:10:19,020 --> 00:10:22,350
Permission Rationale, then we assume they've ticked the box.

240
00:10:22,350 --> 00:10:25,710
So in that case, we just use an intent to stop

241
00:10:25,710 --> 00:10:28,410
the app settings activity, so let's add the code

242
00:10:28,410 --> 00:10:29,740
to the else part to do that.

243
00:10:29,740 --> 00:10:30,790
That's gonna be here.

244
00:10:32,830 --> 00:10:35,870
So the code we want for that, we put a comment firstly

245
00:10:35,870 --> 00:10:38,150
that the user has permanently

246
00:10:44,850 --> 00:10:49,850
denied the permission to take them direct to the settings.

247
00:10:52,680 --> 00:10:55,465
So the actual code, we're gonna start with the log,

248
00:10:55,465 --> 00:10:59,300
so log.d TAG comma, and the message is gonna be snackbar

249
00:11:01,010 --> 00:11:04,603
onClick colon launching settings.

250
00:11:08,240 --> 00:11:12,330
And we're going to do val intent equals Intent,

251
00:11:12,330 --> 00:11:13,903
capital I and then parenthesis.

252
00:11:15,340 --> 00:11:20,340
Then we're gonna do intent.action is equal to settings dot

253
00:11:22,640 --> 00:11:25,490
and it's gonna be action and it's called application

254
00:11:25,490 --> 00:11:27,253
details underscore settings.

255
00:11:29,110 --> 00:11:32,970
I'm going to do val uri is equal to Uri

256
00:11:32,970 --> 00:11:34,427
with a capital U.fromParts.

257
00:11:35,400 --> 00:11:38,120
Then in parenthesis, in double quotes,

258
00:11:38,120 --> 00:11:41,360
lower case word package comma

259
00:11:41,360 --> 00:11:45,973
this.packageName, then no as the third argument.

260
00:11:49,290 --> 00:11:53,573
Then we're gonna do intent.data equals URI.

261
00:11:55,602 --> 00:11:57,552
Then we're gonna do this.startActivity,

262
00:12:01,157 --> 00:12:02,683
but in parenthesis intent.

263
00:12:04,660 --> 00:12:06,790
So we've seen code like this before in the YouTube

264
00:12:06,790 --> 00:12:09,600
app for example, we've created the new intent

265
00:12:09,600 --> 00:12:12,550
then called startActivity to start the activity described

266
00:12:12,550 --> 00:12:14,700
by the intent.

267
00:12:14,700 --> 00:12:17,760
This intent is slightly different because we're specifying

268
00:12:17,760 --> 00:12:19,700
the action we needed to take.

269
00:12:19,700 --> 00:12:22,790
The set action method needs a string specifying

270
00:12:22,790 --> 00:12:24,940
the action to be performed, and here we want

271
00:12:24,940 --> 00:12:27,233
to launch the settings app and have it open

272
00:12:27,233 --> 00:12:29,910
at our application's settings.

273
00:12:29,910 --> 00:12:32,684
Now being Kotlin we access the action property course

274
00:12:32,684 --> 00:12:35,780
rather than going by the setter.

275
00:12:35,780 --> 00:12:37,650
If you wanted to you could bring up the documentation

276
00:12:37,650 --> 00:12:39,610
for the set action method but it really

277
00:12:39,610 --> 00:12:41,920
doesn't say any more than what I've just mentioned.

278
00:12:41,920 --> 00:12:43,950
Now the documentation for this constant

279
00:12:43,950 --> 00:12:46,423
here is Action_Application_Details_Settings

280
00:12:46,423 --> 00:12:49,010
is a lot more informative, so I'll bring up

281
00:12:49,010 --> 00:12:50,660
the documentation for that.

282
00:12:50,660 --> 00:12:52,870
So it's telling us here that it shows details

283
00:12:52,870 --> 00:12:55,450
about a particular application,

284
00:12:55,450 --> 00:12:57,547
and also we have to use the package schema

285
00:12:57,547 --> 00:13:00,050
and specify the application package name

286
00:13:00,050 --> 00:13:01,970
in intent's URI.

287
00:13:01,970 --> 00:13:04,430
Now getting the application's package name is easy,

288
00:13:04,430 --> 00:13:07,370
we just call the getPackageName method on a context.

289
00:13:07,370 --> 00:13:10,490
Now the easiest way to get a context from inside

290
00:13:10,490 --> 00:13:12,540
the listener is to use this to refer to the current

291
00:13:12,540 --> 00:13:14,343
instance of main activity.

292
00:13:15,500 --> 00:13:17,260
Hence the use of his over here.

293
00:13:17,260 --> 00:13:20,950
Now the URI consists of a scheme such as HTTPS

294
00:13:20,950 --> 00:13:24,210
or file or in this case package.

295
00:13:24,210 --> 00:13:28,420
The schema is followed by an SSP or a scheme specific part.

296
00:13:28,420 --> 00:13:31,733
In our case that's just the package name.

297
00:13:33,400 --> 00:13:36,000
See here, and obviously in here with this first part

298
00:13:36,000 --> 00:13:38,350
was the schema that I talked about.

299
00:13:38,350 --> 00:13:41,900
Now I use the URI fromParts method to build up

300
00:13:41,900 --> 00:13:45,970
the URI that we need to pass this data to the intent.

301
00:13:45,970 --> 00:13:48,490
Now we're gonna be using URI's quite a bit soon.

302
00:13:48,490 --> 00:13:50,470
So I'm gonna discuss them in more detail

303
00:13:50,470 --> 00:13:51,750
later in the course.

304
00:13:51,750 --> 00:13:54,290
For now though, what I'm going to do is also

305
00:13:54,290 --> 00:13:57,390
take the opportunity to log the URI that gets created

306
00:13:57,390 --> 00:13:59,490
just so we can see what it looks like.

307
00:13:59,490 --> 00:14:01,413
So I'm gonna put a log message in there.

308
00:14:02,960 --> 00:14:05,950
Log.d parenthesis TAG comma

309
00:14:08,190 --> 00:14:12,440
double quotes gonna be a snackbar colon

310
00:14:13,700 --> 00:14:16,700
space onCLick colon,

311
00:14:16,700 --> 00:14:18,543
URI, or $URI.

312
00:14:20,960 --> 00:14:23,503
So finally then we call online that's 80,

313
00:14:24,470 --> 00:14:25,920
we call the start activity method

314
00:14:25,920 --> 00:14:28,180
to launch the settings for our app.

315
00:14:28,180 --> 00:14:29,840
Now that should be all we need,

316
00:14:29,840 --> 00:14:31,880
but unfortunately this code does

317
00:14:31,880 --> 00:14:34,440
something that we really should avoid doing.

318
00:14:34,440 --> 00:14:36,070
And in the next video we'll run the app

319
00:14:36,070 --> 00:14:38,340
and see what that is and how it behaves.

320
00:14:38,340 --> 00:14:40,040
So I'll see you in the next video.

