Marcos Cobeña Morián: Inject Wave Engine into Xamarin.iOS Apps

My good friend and workmate Sergio Escalada and I wrote a few months ago a quick guide, along with a sample (find the link below), on how you can render Wave Engine on a Xamarin.iOS app: not a full-screen game it-self, but adding specific views which are handled from Wave Engine. Today, we’ve updated the… Continue reading Inject Wave Engine into Xamarin.iOS Apps

Xamarin: Getting Started with the Media Plugin for Xamarin

Ever since their invention, cameras have played a huge role in society. With the advent of mobile phones, more people than ever before now have photo and video capabilities at their disposal with the tap of a button. As developers, users expect us to take full advantage of the device capabilities, including the camera, to […]

The post Getting Started with the Media Plugin for Xamarin appeared first on Xamarin Blog.

Gerald Versluis: Push notifications with Xamarin – Windows Phone

To conclude my ‘push notifications’ series I will now tell you how to implement push notifications on Windows Phone.
Be sure to read my previous two posts on the notifications for iOS and setting up Azure and also implementing on Android. If you did read and/or follow them, this will be a piece of cake (hmm cake.). I find Windows Phone by far the easiest platform to implement notifications on. So lets get crackin’!

Prepare Azure

As you might expect, following my last few posts, I will first prepare Azure for sending notifications to our Windows Phone clients. So first step; go to the Azure management portal, to your Notification hub and find the Configure tab once more. Also, we need to go to the Windows developer portal. If you haven’t already done so; create a app entry for your app and go into the details.

In the left menu find ‘Services’ and then ‘Push notifications’ as shown below.

Windows Developer Dashboard
Windows Developer Dashboard

In the next screen watch closely to find a link to the ‘Live Services site’ and click it. This will most likely prompt you to login again.
At the page you reach then you will see the needed information for our Azure back-end. Find the values under ‘Package SID’ and ‘Client secret’ and paste them in the corresponding fields in your Azure configuration. Don’t forget to hit the ‘Save’ button at the bottom!

If all is well the values are accepted and you are done configuring Azure!

Updating our app

Other then iOS and Android on Windows you don’t get a unique token for your device, but you get a URL which acts as a notification channel.
Luckily the rest of the workflow is the same as the other platforms so we can follow along the same path.

Because Windows Phone is just supported out-of-the-box by Visual Studio we can leverage a available NuGet package to implement the push notifications. The only issue they have created now is that there are two flavours of Windows Phone apps; Silverlight and Universal Windows apps.
Because te later is going to be the future and is now the default template when you create a Xamarin.Forms solution I will only handle this one.

Go ahead and add the WindowsAzure.Messaging.Managed NuGet package to the WinPhone project. Then in the App.xaml.cs find the OnLaunched event.
This event is fired, as you would expect, when the app is launched. Right after the opening tag you place this code;

protected async override void OnLaunched(LaunchActivatedEventArgs e)
{
    var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();

    // TODO add connection string here
    var hub = new NotificationHub("XamarinNotifications", "<connection string with listen access>");
    var result = await hub.RegisterNativeAsync(channel.Uri);

    // Displays the registration ID so you know it was successful
    if (result.RegistrationId != null)
    {
        Settings.DeviceToken = result.RegistrationId;
    }

    // The rest of the default code is here
}

Don’t forget to add the async keyword in the method signature.

When you take a close look at the code you will see that we try to create a channel over which we will receive the notifications. On the other platforms we only have a token which identifies the device, on Windows you also get a channel in the form of a URL with which we can reach the device. We only save the registration ID for now.

Again, I am using the Settings plugin to save this token for later use.

Also, you see that there is still a TODO in there, you have to insert a connection string. In the other project this is inferred from the access code you insert there. Here you need to provide the full connection string. You can find it by going to your Azure management portal, open the Service Bus screen and navigate to your Notification Hub. At the bottom you will find the ‘Connection Information’ button. When you click it you will see the DefaultListenSharedAccessSignature key. You need the value that is after this key.

The last thing you need to do is declare that the app wants to use Toast capabilities. To do this go into your WinPhone project and find the ‘Package.appxmanifest’ file. Double-click it and set the Toast capable field to Yes. If you wondered; yes, toast is Microsofts way of saying push messages. Check out the different kind of messages you can send here.

Enable Toast capabilities
Enable Toast capabilities

Now run the app in the emulator and get back to your Azure management portal to test this out, right now!

In the Debug tab of your notification hub set the platform to Windows, and the notification type to.. Surprise, surprise; toast!

Send test notification Windows
Send test notification Windows

Now the only thing left is to push the Send button at the bottom of the screen and switch back over to your emulator and behold your new, epic, shiny push notification on Windows Phone!

Test notification Windows Phone
Test notification Windows Phone

As usual, find the sample code on my updated GitHub. For the last part, next time stay tuned to create a console tool which sends out push notifications to all of your apps at once!

Michael Ridland: FreshEssentials for Xamarin.Forms – The must-have nuget for Forms

Ah this is one I’ve been wanting to do for a long time and I’m pretty excited about it. We use it everyday, as it’s really useful. FreshEssentials for Xamarin.Forms has ONLY the most common elements you need for Xamarin.Forms. It’s contains the elements you need in almost every project and nothing more, things like BindablePicker, SegementedButtons, […]

The post FreshEssentials for Xamarin.Forms – The must-have nuget for Forms appeared first on Michael Ridland.

Xamarin: Podcast: Continuous Integration & Deployment

This week on the Xamarin Podcast, James Montemagno and I share our experiences with both continuous integration and continuous deployment and provide some of our favorite services and actionable steps to get your own continuous infrastructure up and running in no time. Subscribe or Download Today Knowing the latest in .NET, C#, and Xamarin is […]

The post Podcast: Continuous Integration & Deployment appeared first on Xamarin Blog.

Adam J Wolf: Weekly Xamarin Newsletter Issue #88

Download the Xamarin Evolve 2016 Conference App James Montemagno releases the Evolve 2016 App on iOS, Android and Windows Phone. Using Xamarin Forms Effects Corrado makes a few tweaks to UI controls for each platform. Custom Animations in Xamarin Forms Adam Pedley is on fire with his progress bar animation. Simple Cross-Platform File IO for […]

The post Weekly Xamarin Newsletter Issue #88 appeared first on Syntax is my UI.

Xamarin: Download the Xamarin Evolve 2016 Conference App

Xamarin Evolve 2016 is just weeks away, and we’ve compiled everything you need to know about the event into one beautiful app for iOS, Android, and Windows 10. Build your dream schedule for the sessions you wish to attend, connect with conference speakers, view special events, and work on mini-hacks with our complete mobile app-we […]

The post Download the Xamarin Evolve 2016 Conference App appeared first on Xamarin Blog.

Xamarin: Simple Cross-Platform File IO for iOS, Android, and Windows

Most mobile applications need to interact with the underlying file system. Be it building a database or caching data, some understanding of how file systems work on target platforms is required. If you’re working with multiple platforms, not only does this require understanding of how each individual file system works, but also how to work with […]

The post Simple Cross-Platform File IO for iOS, Android, and Windows appeared first on Xamarin Blog.