1 00:00:00,610 --> 00:00:04,900 Our pizza calculator service now doesn't have the correct signature. 2 00:00:04,900 --> 00:00:08,225 So we need to create a phone dialer to pass into it. 3 00:00:17,577 --> 00:00:21,020 The context, like I said, is also our activity. 4 00:00:21,020 --> 00:00:23,022 So we can just pass in this. 5 00:00:30,126 --> 00:00:33,250 Let's run the Android app and see how it looks. 6 00:00:34,730 --> 00:00:38,800 First, we must set as our StartUp Project the Android project. 7 00:00:40,350 --> 00:00:42,660 It's already selected our preferred device to debug. 8 00:00:45,300 --> 00:00:52,155 Now that our Android emulator is up and running, we can enter a value, calculate. 9 00:00:52,155 --> 00:00:58,090 You see our new message with 11 pizzas, and we can call. 10 00:00:59,290 --> 00:01:01,050 You notice the call button didn't do anything. 11 00:01:02,110 --> 00:01:06,170 That's because we didn't add an event to it. 12 00:01:09,250 --> 00:01:14,836 Back in the main activity, let's add an event to the call button. 13 00:01:25,969 --> 00:01:28,168 We'll use our pizzaCalculatorService. 14 00:01:30,631 --> 00:01:32,275 And call our pizza parlor. 15 00:01:40,207 --> 00:01:41,373 Now if we run it again. 16 00:01:44,520 --> 00:01:45,959 We enter the number of people. 17 00:01:48,868 --> 00:01:49,994 We get our message. 18 00:01:53,902 --> 00:01:56,238 And when we call, we get the call dialogue. 19 00:02:03,337 --> 00:02:05,774 Now let's do the same thing for iOS. 20 00:02:28,288 --> 00:02:33,710 In the phone dialer for iOS, we'll need to have a handle on the UI View Controller so 21 00:02:33,710 --> 00:02:37,140 that we can interact with the interface. 22 00:02:37,140 --> 00:02:38,882 So let's pass it into the constructor. 23 00:03:13,299 --> 00:03:15,966 Now that we have a handle on the UI View Controller, 24 00:03:15,966 --> 00:03:17,772 we can implement the Call method. 25 00:03:31,432 --> 00:03:33,717 We will also need to create a URI here. 26 00:03:37,716 --> 00:03:40,220 Using the iOS framework. 27 00:03:52,354 --> 00:03:57,377 And with iOS, we first wanna test to see if we can actually open this URI. 28 00:04:14,199 --> 00:04:17,850 So if we can open the URI, it will just open. 29 00:04:17,850 --> 00:04:21,100 But because we put a not sign here, if it doesn't open, 30 00:04:21,100 --> 00:04:23,187 we can handle it in a different way. 31 00:04:30,575 --> 00:04:32,124 We'll use an alert controller. 32 00:04:39,080 --> 00:04:40,189 To create a message. 33 00:05:11,879 --> 00:05:16,630 I've given this alert controller a title and a message. 34 00:05:16,630 --> 00:05:18,372 Now we need to indicate the style. 35 00:05:24,301 --> 00:05:28,182 If we wanna close this dialogue, we'll have to handle the OK button, but 36 00:05:28,182 --> 00:05:31,009 in this case we're just going to close the dialogue.