#madebygoogle – new hardware: Google Pixel & others

Right, so the #madebygoogle event just ended & well… my expectations were not met. I expected some breakthrough in hardware (Google Pixel) or at least some new & innovative piece of software; expectations not met.

Google Assistant – we’re there already with Siri and Cortana. Of course, Google has a lot more data about you meaning it can give you better, more personalized results, but that’s far from innovation.

Next, Google Pixel – a phone designed entirely by Google.

  • it’s the first phone to come with Google Assistant & Daydream VR
  • camera – apparently the highest rated camera on a smartphone. Great performance in low light, HDR+ and very fast image capturing (they actually said it’s instant – curious about that)
  • fast charging 7 hours in 15 minutes
  • unlimited storage for photos & videos on Google Drive

Curious to see actual reviews but so far I’m not impressed.

Regarding availability:

  • in the US it will be available exclusively on Verizon; with an unlocked version available on the Google Store
  • the retail price for Google Pixel is $649
  • countries: US, Australia, Canada, Germany and the UK; India starting on 13th of October

Colors – this deserves more than a bullet point. I thought it’s 1st of April. The phone will be available in:

  • quite black
  • very silver
  • really blue



Google Duo – some new video calling app with a neat Knock feature which will live-stream the caller before you answer; really cool when it’s your kid calling – hopefully they thought of preventing abuse. Nothing new otherwise.

Daydream VR – requires a headset. Very similar in shape & size to a Samsung Gear VR. The “BIG” difference is that it’s covered in fabric as to offer better comfort. I’m not sold.

It has wireless communication with the device & a small controller containing various sensors to allow you to interact in the virtual reality.

Daydream VR will become avaiable somewhere in November for the retail price of $79.

Google WiFi – basically a bunch of WiFi repeaters with a user-friendly management app. Great for non-techies, don’t know about me.

Pre-orders start in November with shipments in December. The price tag will be $129 for the single pack and $299 for the 3-pack.

Chromecast Ultra – now with 4K resolution, HDR and Dolby Vision support. Apparently 1.8x faster than it’s predecessor.

Best of all – it now has an Ethernet port!

As for availability – somewhere in November for around $69. Hope they change the name before they release it – call it something like Chromecast 3.0. Chromecast Ultra…

Google Home – you know Amazon Echo? Take that & put Google Assistant on it and you get Google Home. They show off with sound quality – but I doubt they can compete with a home cinema.

Worst of all – it comes with 6 months of YouTube Red – meaning that after that expires you’ll get ads. I would’ve expected that since I’ve actually paid for the device I wouldn’t get ads while streaming on the TV. I was wrong.

The thing will retail for $129; they didn’t say when.

& the event ended with a high-level presentation of whats coming for developers later in December – ways to interact with the Google Assistant through Actions (more details: https://developers.google.com/actions/).

Still don’t know what to make of it. Disappointing in a way. What do you think?



Only 3 hours left to go.

The tech giant is rumored to debut two new Pixel smart phones, Google Home, a VR headset (potentially a collaboration with Cardboard), a new Chromecast, Google Wi-Fi, a new Android tablet, Android accessories, and Android + Chrome (for a second go around).

Live stream embedded below for convenience.

Continue reading #madebygoogle

How To: Add AdMob to your Xamarin Forms app

One of the first things people think about when developing for a new platform / using a new technology is monetization; and in my case the question is: how easy is it to integrate AdMob? For Xamarin Forms the answer would be: “It depends” – it depends on luck & on the complexity of what you want to achieve; but I will detail this as we move along.

The first thing you need to do is add the required components to your projects. For this walktrough I will be using Visual Studio but it should be relatively the same when using Xamarin Studio. Here, things go separate ways for each of the platforms:

  • for Android – add the Google Play Services component
  • for iOS – add the AdMob component
  • for Windows Phone – download the SDK from here and add it as a reference

By now, you Android project should no longer be building & you should be receiving a COMPILETODALVIK : UNEXPECTED TOP-LEVEL error. To fix that, go into your Droid project properties, select the Android Options tab and then under Advanced modify the value for the Java Max Heap Size to 1G. Your project should now build without any errors.

Next, inside your shared / PCL project add a new Content View and call it AdMobView. Remove the code generated inside it’s constructor & it should look like this:

public class AdMobView : ContentView
    public AdMobView() { }

Add this new view to your page. In XAML you can do it like this:

<controls:AdMobView WidthRequest="320" HeightRequest="50" />

Make sure NOTHING interferes with the control. By nothing I mean – overlapping controls, page padding, control margins / spacing, etc. If you have something overlapping the ad control, ads will not display & you won’t receive an error, so be careful.

Next, it’s time to add the custom view renderers; and again, we’ll handle each platform:


Add a new class called AdMobRenderer with the code below. Make sure to keep the ExportRenderer attribute above the namespace, otherwise the magic won’t happen.

[assembly: ExportRenderer(typeof(AdMobView), typeof(AdMobRenderer))]

namespace AdExample.Droid.Renderers
    public class AdMobRenderer : ViewRenderer<AdMobView, Android.Gms.Ads.AdView>
        protected override void OnElementChanged(ElementChangedEventArgs<AdMobView> e)

            if (Control == null)
                var ad = new Android.Gms.Ads.AdView(Forms.Context);
                ad.AdSize = Android.Gms.Ads.AdSize.Banner;
                ad.AdUnitId = "_your_admob_ad_unit_id_goes_here_";

                var requestbuilder = new Android.Gms.Ads.AdRequest.Builder();


Next, you need to modify your AndroidManifest.xml file to add the AdActivity & required permissions for displaying ads: ACCESS_NETWORK_STATE, INTERNET; just like in the example below.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
	<uses-sdk android:minSdkVersion="15" />
    <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:theme="@android:style/Theme.Translucent" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission android:name="android.permission.INTERNET" />

That’s it. Your Android build should now display ads inside the AdMobView content view.

Windows Phone

Just like for Android, add a new class to your WinPhone project called AdMobRenderer having the code below.

[assembly: ExportRenderer(typeof(AdMobView), typeof(AdMobRenderer))]

namespace AdExample.WinPhone.Renderers
    public class AdMobRenderer : ViewRenderer<AdMobView, GoogleAds.AdView>
        protected override void OnElementChanged(ElementChangedEventArgs<AdMobView> e)

            if (Control == null)
                var ad = new GoogleAds.AdView();
                ad.Format = AdFormats.Banner;
                ad.AdUnitID = "_your_admob_ad_unit_id_goes_here_";

                var adRequest = new GoogleAds.AdRequest();



This, I haven’t got the chance to test yet as I don’t have a Mac around but people say it works, so I’ve added it for reference. Same as before, just add a new class called AdMobRenderer and copy-paste the code below.

[assembly: ExportRenderer(typeof(AdMobView), typeof(AdMobRenderer))]

namespace GazetaSporturilor.iOS.Renderers
    public class AdMobRenderer : ViewRenderer
        const string AdmobID = "_your_admob_ad_unit_id_goes_here_";

        GADBannerView adView;
        bool viewOnScreen;

        protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.View> e)

            if (e.NewElement == null)

            if (e.OldElement == null)
                adView = new GADBannerView(GADAdSizeCons.SmartBannerPortrait)
                    AdUnitID = AdmobID,
                    RootViewController = UIApplication.SharedApplication.Windows[0].RootViewController

                adView.AdReceived += (sender, args) =>
                    if (!viewOnScreen) this.AddSubview(adView);
                    viewOnScreen = true;

                GADRequest request = GADRequest.Request;


That’s it. Now you have ads being served on all platforms. Any comments or suggestions you have leave them in the comments section below.

Fix Xamarin error – Csc.exe exited with code -1073741790. (MSB6006)

Just run Xamarin Studio as an Administrator.

The error usually means that the process cannot access a certain resource. In my case that meant insufficient rights; but it could also mean that some file is already in use; in that case – Clean the solution & Rebuild and if that doesn’t work either do a manual cleanup of the solution bu deleting the “bin” and “obj” folders for every project in your solution.

Changing the Cordova version used by Hybrid Apps in Visual Studio 2013

Updating the Cordova version requires you to edit the platforms.js file found in:


You can change the version individually for each platform, tho I suggest you use the same version for all.
Also, it might be the case you’re looking to update only because of the Google Play warning regarding the high severity cross-application scripting (XAS) vulnerability found in Cordova 3.5.0. If so here you have the file updated to point to version 3.5.1 which fixes the mentioned vulnerability: platforms.js.

Note: In case you are using CTP 1 of the Hybrid Apps the path will be different:

Counting up to one trillion

How long does it take a computer to count up to one trillion?

This is a question that came after a discussion with a colleague of mine at the university. He was telling me about some company worth over 20 trillion dollars – and he just couldn’t imagine how that much money would look like in cash. Just to get an idea of it we calculated how many hundred dollar bills it would take to circle the Earth once – the answer was I believe around 240.000.000 meaning around 24 billion US dollars. That’s a lot of money. How much would it take a person to count that much money? Well, I can’t say for sure.

What we can do to get an idea is see how much it would take a computer to count up to that value. To simply iterate, no other action in between. For that I’ve wrote a simple piece of code which measures how much it takes to count up to one million and then does some simple math to estimate how much it would take to count up to different values and then displays the results in a friendly way using a method courtesy of StackOverflow.

The results are interesting. And the answer is: it depends on your machine. Even on the same machine you will get different results depending on the load. But let’s look at mine for a bit:

  • one billion (9 zeros) is being reached fast – 15 seconds
  • but to get to one trillion (12 zeros) – the difference is amazing – 4 hours and 10 minutes. Basically 1000 times more.
  • the differences get even more impressive as we go up to quadrillions (15 zeros)  which would take 173 days and then quintillions (18 zeros) which would take 475 years
  • the last one for which I did the math is one sextillion (21 zeros) and get ready – it would take my laptop exactly 7708 years, 292 days, 6 hours, 43 minutes and 52 seconds to iterate up to that value.

Continue reading Counting up to one trillion

Adding speech recognition to your WP8 app

To add speech recognition to our app we will be using the newly released version of the Windows Phone toolkit (release June 2013) – which adds a nice new control called SpeechTextBox (that does exactly what you think). You can get the latest build using NuGet or you can download the source from CodePlex.

Once you’ve referenced the toolkit in you project all you are left to do is add the control:

<toolkit:SpeechTextBox SpeechRecognized="SpeechTextBox_SpeechRecognized" />

Handling the SpeechRecognized event is not necessary. I’ve left it there just to point out that you can choose what you want to do with the speech recognition result. The event comes with a SpeechRecognizedEventArgs parameter which allows you to check the level of confidence for the recognized phrase and also get details about the phrase semantics.

Periodically update your live tiles using ScheduledTaskAgent

I’ve covered in a previous post how to create wide tiles for your Windows Phone 7 application. Now it’s time to bring them to life. The easiest way to do so is by using a ScheduledTaskAgent. To create one go ahead and add a new project to your solution and from the project templates list choose ‘Windows Phone Scheduled Task Agent’.

Before we go any further – go ahead and add this new (task agent) project as a reference in the main application project.

This will create for you a class called ‘ScheduledAgent’ which inherits ‘ScheduledTaskAgent’. You can leave the constructor of the class and the exception handler as they are. The method that interests us is ‘OnInvoke’. This is the method that will be called for us periodically for as long as the agent is running.

This is the method in which we will update our live tile. Let’s say we update our tile from a RSS feed. So the first thing we need to do is download our feed.

protected override void OnInvoke(ScheduledTask task)
    WebClient client = new WebClient();
    client.DownloadStringCompleted += (s, e) =&gt;
            DownloadStringCompleted(s, e);
    client.DownloadStringAsync(new Uri(&quot;http://blogs.windows.com/windows_phone/b/windowsphone/rss.aspx&quot;));

Once downloaded, deserialize it, take the first (latest) item and use the title and image to update your live tile.

private void DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
    if (e.Error == null)
        StringReader stringReader = new StringReader(e.Result);
        XmlReader xmlReader = XmlReader.Create(stringReader);
        SyndicationFeed feed = SyndicationFeed.Load(xmlReader);

        var latestArticle = feed.Items.FirstOrDefault();
        var tile = ShellTile.ActiveTiles.FirstOrDefault();
        if (tile != null)
            var tileData = new FlipTileData();
            tileData.Title = &quot;Windows Phone Blog&quot;;

            var content = latestArticle.Title.Text + &quot; - &quot; + latestArticle.Summary.Text;
            var image = latestArticle.Links.FirstOrDefault(l =&gt; l.MediaType != null &amp;&amp; l.MediaType.Contains(&quot;image&quot;)).Uri;

            tileData.BackContent = content;
            tileData.BackgroundImage = image;

            tileData.WideBackContent = content;
            tileData.WideBackgroundImage = image;

Pay attention to where I call NotifyComplete()! This method releases all the resources used by the agent. It is important to call this method because otherwise the task will never end and thus will never start again. It is also very important to call it when everything is done – in this particular case in the DownloadStringCompleted event, after updating the live tiles.

This leaves us with only one thing left to do: registering the scheduled task. We will do this in the Application_Launching event (found in App.xaml.cs).

private void Application_Launching(object sender, LaunchingEventArgs e)
    var taskName = &quot;WindowsPhoneBlogSTA&quot;;
    PeriodicTask periodicTask = ScheduledActionService.Find(taskName) as PeriodicTask;
    if (periodicTask != null)

    periodicTask = new PeriodicTask(taskName) { Description = &quot;Periodic task to update the tile of &lt;your app&gt;.&quot; };
        #if DEBUG
            ScheduledActionService.LaunchForTest(taskName, TimeSpan.FromSeconds(30));
    catch (InvalidOperationException) { }

Creating wide tiles for your Windows Phone 7 app

I’ve recently come across an article in the Nokia Developer Wiki about creating live tiles (including wide tile) for both Windows Phone 7 and Windows Phone 8 by writing a single piece of code that works in both versions of the OS.

To do this you will need to use the MangoPollo library which you can easily get from NuGet. The library uses reflection to create your live tiles depending on the OS version the app is running in. Creating your tiles is easy:

var tile = ShellTile.ActiveTiles.FirstOrDefault();
if (tile != null)
    var tileData = new FlipTileData();
    tileData.Title = "Start Debugging";

    tileData.BackContent = "switch to windows phone, we've got candy";
    tileData.BackgroundImage = new Uri("Assets/tileBackground.png", UriKind.Relative);
    tileData.BackBackgroundImage = new Uri("Assets/tileBackBackground.png", UriKind.Relative);

    tileData.WideBackContent = "switch to windows phone, we've got candy";
    tileData.WideBackgroundImage = new Uri("Assets/wideTileBackground.png", UriKind.Relative);
    tileData.WideBackBackgroundImage = new Uri("Assets/wideTileBackBackground.png", UriKind.Relative);


That’s all you need to do. Both the normal and wide live tiles should now be available when resizing the tile of your app. Now all that’s left for you to do is to update it.

Also, one thing that wasn’t so obvious for me – you can use absolute URIs for the tile images. eaning that you can give as a source a image directly from the internet and the OS will download and cache it for you.

tileData.WideBackgroundImage = new Uri("http://cdn.marketplaceimages.windowsphone.com/v8/images/0a539106-8940-4898-99c2-744cbc7a6097?imageType=ws_icon_small", UriKind.Absolute);

Insolated Storage Settings Helper for Windows Phone

Decided that I’d share a really simple helper class that I often use in my Windows Phone apps. It’s called IsolatedStorageSettingsHelper and it only has three methods:

  • T GetItem<T>(string key) – gets the object with the specified key from the IsolatedStorageSettings. If there isn’t an object with that key it will return null. If the object is not of the type specified then it will return a new instance of T.
  • void SaveItem(string key, object item) – saves the item passed as a parameter in the IsolatedStorageSettings using the specified key.
  • void SaveItems(Dictionary<string, object> items)  – used for saving multiple items at once. All the items in the dictionary are saved in the IsolatedStorageSettings with their respective keys.

This is not much, but that’s all I ever needed for my apps. Hope it will be of help. Code below.

public class IsolatedStorageSettingsHelper
   public static void SaveItem(string key, object item)
      IsolatedStorageSettings.ApplicationSettings[key] = item;

   public static void SaveItems(Dictionary<string, object> items)
      foreach (var item in items)
         IsolatedStorageSettings.ApplicationSettings[item.Key] = item.Value;

   public static T GetItem<T>(string key)
      T item;
         IsolatedStorageSettings.ApplicationSettings.TryGetValue<T>(key, out item);
      catch (InvalidCastException ice)
         return default(T);
      return item;