Monetizing App Studio with Ads

bitdisaster:

A great walk-through on how to enable Ad’s in AppStudio Apps by Lance McCarthy.

Originally posted on Boston Windows Phone Developer:

So, you’d like to put some ads in your awesome App Studio app? No problem! I thought I would write a post to show just how easy it can be. Follow these easy steps and you’ll start earning money from ads…

Ad provider

The ad provider is the service the AdControl in your app gets the ad to display and also where you earn the revenue. As of Windows Phone 8 there is a PubCenter AdControl built into the framework, all you need to do is get an ApplicationId and an AdUnitId. You get that information from Windows Phone DevCenter, find out how to get your ApplicationId and AdUnitId in this great blog post.

If you want to use a separate Ad provider, for example AdDuplex, you’ll need to add the provider’s DLLs to your project. I’m using AdDuplex in the example below, learn how to add AdDuplex to your project here.

Step…

View original 315 more words

Some Eye Candy for PowerShell

With the introduction of PowerShell as a modern replacement for the good old CMD, it became quickly the standard command line for Windows based systems . These days PowerShell commands Windows Server, Databases and even the Cloud. However, it still looks like the good old MsDos console from Windows 95.

In order to give the default PowerShell console some charm I created a little helper tool that allows to set the transparency of a Window. Actually it sets transparency for all Windows of a given process name. My little tool WinStyler uses the Win32 API to modify styling of existing Windows. Are you surprised that Windows allows transparent Windows? Don’t be. It had the ability since Windows 2000 but was never exposed to the end user. In order to modify a Window, we have to specify the process name and the new alpha value for the Window. In the case of PowerShell the call is  WinStyler –p PowerShell –a 200. Values between 1 and 255 are valid as alpha value. This also works for other programs. E.g. cmd.exe

And this is what PowerShell looks like on top of a nice Desktop Wallpaper.

imageIf you like it more minimalistic then call WinStyler with parameter –n (WinStyler -p PowerShell -n). This will remove the Border and Caption. While that looks pretty nice, you will loose the ability to resize the Windows and to call the Property Window. You can restore the chrome with the parameter –r (WinStyler -p PowerShell -r). Unfortunately it also causes some artefacts while scrolling.

image

PowerShell Profile Integration

If you like the transparent PowerShell Windows and want them to look like that by default then you can call WinStyler via your PowerShell profile. If a folder called WindowsPowerShell  does not already exists within your Documents folder then create it. Now add a file called Microsoft.PowerShell_profile.ps with the content below.  Also copy the WinStyler.exe into the folder. 

Microsoft.PowerShell_profile.p
  1. $env:Path += ";$Env:HOMEPATH\Documents\WindowsPowerShell"
  2. WinStyler.exe -p PowerShell -a 180 -n
  3. cls
  4. "Welcome master " + $env:Username

If your profile script fails then you probably have to lift the execution policy. The code below will change the execution policy. (Warning: This will also allow to run any other script on your machine. Including malware. Just saying.)

Code Snippet
  1. Set-ExecutionPolicy Unrestricted -Scope CurrentUser

Download the WinStyler binary here http://sdrv.ms/1mvgxEH.

If you would rather see what will be executed on your machine and want to compile it yourself then the C# source code can be found here http://sdrv.ms/1mvgAAj .

Great end of the year blowout

And the winners are:

  • Michael Wu – Backpack
  • Gordon Kennett – Backpack
  • Matt Hughson – Backpack
  • XiangWei Jiang – Charger
  • Heather Robinson –  JBL PowerUp Speaker
  • Mike Wuetherick – Lumia 822
  • Steven Yang – Lumia 822

The winners will be contacted and prizes shipped next week. Congratulations!

Its the end of the year and I have few giveaways that need to go.  As usual, my challenge is simple. Create or update a new Windows Phone app/game. To be eligible you must be in my area and your app/game must be released or updated after 1st of December. I know Christmas is coming up and I don’t want to keep you from spending time with your family. That’s why I set the deadline for app submission to the 15th of January 2014. However you need to enter via email by 31st of December 2013.

Winners will be drawn from all entries after the 15th of January 2014.

Draw Prizes

  • 2 Nokia Lumia 822
  • 1 JBL PowerUp Speaker
  • 3 DVLUP Backpacks
  • 1 Wireless Charging Plate

Rules

  • You must live in one of the following Provinces or States:
    • British Columbia
    • Saskatchewan
    • Alberta
    • Yukon
    • Northwest Territories
    • Washington
    • Alaska
    • Montana
  • Your app/game must be released or updated after the 1st of December 2013.

How to Enter

Send an email to nokiaguy@outlook.com with subject “Blowout” by Dec 31st 2013 the following information.

  1. Name
  2. Email Address
  3. Windows Phone Marketplace Publisher Name
  4. Twitter Id (if you have one)
  5. Link to your latest app (if you have one already)
  6. DVLUP user name (sign up here http://dvlup.com )
  7. Your location, State/Province and City

By January 15th send me a link to your new or updated app to nokiaguy@outlook.com with subject “Blowout”. Your app/game release or update date must be after the 1st of December 2013.

Developer Tools

Just a browser (AppStudio)

For developing AppStudio apps all you need is a browser. However, to actually test your app you need a Windows Phone 8 device. But We can help with that. Give it a try http://apps.windowsstore.com/

Windows 8 Pro with Hardware Virtualization

To write native Windows Phone 8 apps, you will need to be using Windows 8 Pro and a PC that supports hardware virtualization. The free Windows Phone 8 SDK can be downloaded here.  https://dev.windowsphone.com/en-us/downloadsdk

Windows 7/8 without Hardware Virtualization

Windows Phone 7 apps are welcome as well and the requirements for the development environment are easier to fulfill. The free SDK can be downloaded here  https://dev.windowsphone.com/en-us/downloadsdk Don’t forget to install all the updates up to WP 7.8.

Disclaimer:

All Apps will be assessed by me and my decisions regarding validity in this promotion are final. This promotion is being held by me, without any express written or implied consent or participation from any third party. By submitting your apps to me for evaluation, you agree to hold me not responsible for any promotion, remuneration or other, expectations whether implied or inferred.  I am doing this to help developers, not looking for any problems.

    Simple Encryption for Windows, WinRT and Windows Phone

    Having three different platforms involved in one project can be challenging. Especially when it comes to missing API’s or similar API’s but with different behaviour. In my case it was encryption. I already had things running with a WPF admin client and Windows Phone app for customers. The WPF client encrypts and uploads a data to Azure Storage from where it is consumed by the Windows Phone app. As encryption I use the symmetric-key algorithm AES. The full .NET framework and the Windows Phone platform provides the AesManaged class that implements the AES algorithm. That worked just fine till I started the development on the Windows 8 version of the very same app and I discovered that WinRT doesn’t provide the AesManaged class. But sure enough, a AES implementation in the Windows.Security.Cryptography namespace could be found. However, I couldn’t managed to get the file decrypted on the WinRT side. Till I found a post by Ginny Caughey with good sample code that worked for all three platforms. After fighting some encoding issues, I came up with the code of an little encryption helper class that is mainly based on Ginny’s implementation. Thanks again Ginny! The class can be used to encrypt/decrypt data on all three platforms. I hope this helps other that face the very same problem.

    public static class EncryptionHelper
        {

    #if NETFX_CORE
            public static byte[] Encrypt(string plainText, string pw, string salt)
            {
                IBuffer pwBuffer = CryptographicBuffer.ConvertStringToBinary(pw, BinaryStringEncoding.Utf8);
                IBuffer saltBuffer = CryptographicBuffer.ConvertStringToBinary(salt, BinaryStringEncoding.Utf16LE);
                IBuffer plainBuffer = CryptographicBuffer.ConvertStringToBinary(plainText, BinaryStringEncoding.Utf16LE);

                // Derive key material for password size 32 bytes for AES256 algorithm
                KeyDerivationAlgorithmProvider keyDerivationProvider = Windows.Security.Cryptography.Core.KeyDerivationAlgorithmProvider.OpenAlgorithm("PBKDF2_SHA1");
                // using salt and 1000 iterations
                KeyDerivationParameters pbkdf2Parms = KeyDerivationParameters.BuildForPbkdf2(saltBuffer, 1000);

                // create a key based on original key and derivation parmaters
                CryptographicKey keyOriginal = keyDerivationProvider.CreateKey(pwBuffer);
                IBuffer keyMaterial = CryptographicEngine.DeriveKeyMaterial(keyOriginal, pbkdf2Parms, 32);
                CryptographicKey derivedPwKey = keyDerivationProvider.CreateKey(pwBuffer);

                // derive buffer to be used for encryption salt from derived password key
                IBuffer saltMaterial = CryptographicEngine.DeriveKeyMaterial(derivedPwKey, pbkdf2Parms, 16);

                // display the buffers – because KeyDerivationProvider always gets cleared after each use, they are very similar unforunately
                string keyMaterialString = CryptographicBuffer.EncodeToBase64String(keyMaterial);
                string saltMaterialString = CryptographicBuffer.EncodeToBase64String(saltMaterial);

                SymmetricKeyAlgorithmProvider symProvider = SymmetricKeyAlgorithmProvider.OpenAlgorithm("AES_CBC_PKCS7");
                // create symmetric key from derived password key
                CryptographicKey symmKey = symProvider.CreateSymmetricKey(keyMaterial);

                // encrypt data buffer using symmetric key and derived salt material
                IBuffer resultBuffer = CryptographicEngine.Encrypt(symmKey, plainBuffer, saltMaterial);
                byte[] result;
                CryptographicBuffer.CopyToByteArray(resultBuffer, out result);

                return result;
            }

            public static string Decrypt(byte[] encryptedData, string pw, string salt)
            {
                IBuffer pwBuffer = CryptographicBuffer.ConvertStringToBinary(pw, BinaryStringEncoding.Utf8);
                IBuffer saltBuffer = CryptographicBuffer.ConvertStringToBinary(salt, BinaryStringEncoding.Utf16LE);
                IBuffer cipherBuffer = CryptographicBuffer.CreateFromByteArray(encryptedData);

                // Derive key material for password size 32 bytes for AES256 algorithm
                KeyDerivationAlgorithmProvider keyDerivationProvider = Windows.Security.Cryptography.Core.KeyDerivationAlgorithmProvider.OpenAlgorithm("PBKDF2_SHA1");
                // using salt and 1000 iterations
                KeyDerivationParameters pbkdf2Parms = KeyDerivationParameters.BuildForPbkdf2(saltBuffer, 1000);

                // create a key based on original key and derivation parmaters
                CryptographicKey keyOriginal = keyDerivationProvider.CreateKey(pwBuffer);
                IBuffer keyMaterial = CryptographicEngine.DeriveKeyMaterial(keyOriginal, pbkdf2Parms, 32);
                CryptographicKey derivedPwKey = keyDerivationProvider.CreateKey(pwBuffer);

                // derive buffer to be used for encryption salt from derived password key
                IBuffer saltMaterial = CryptographicEngine.DeriveKeyMaterial(derivedPwKey, pbkdf2Parms, 16);

                // display the keys – because KeyDerivationProvider always gets cleared after each use, they are very similar unforunately
                string keyMaterialString = CryptographicBuffer.EncodeToBase64String(keyMaterial);
                string saltMaterialString = CryptographicBuffer.EncodeToBase64String(saltMaterial);

                SymmetricKeyAlgorithmProvider symProvider = SymmetricKeyAlgorithmProvider.OpenAlgorithm("AES_CBC_PKCS7");
                // create symmetric key from derived password material
                CryptographicKey symmKey = symProvider.CreateSymmetricKey(keyMaterial);

                // encrypt data buffer using symmetric key and derived salt material
                IBuffer resultBuffer = CryptographicEngine.Decrypt(symmKey, cipherBuffer, saltMaterial);
                string result = CryptographicBuffer.ConvertBinaryToString(BinaryStringEncoding.Utf16LE, resultBuffer);
                return result;
            }

    #else

            public static byte[] Encrypt(string dataToEncrypt, string password, string salt)
            {
                AesManaged aes = null;
                MemoryStream memoryStream = null;
                CryptoStream cryptoStream = null;

                try
                {
                    //Generate a Key based on a Password, Salt and HMACSHA1 pseudo-random number generator
                    Rfc2898DeriveBytes rfc2898 = new Rfc2898DeriveBytes(password, Encoding.Unicode.GetBytes(salt));

                    //Create AES algorithm with 256 bit key and 128-bit block size
                    aes = new AesManaged();
                    aes.Key = rfc2898.GetBytes(aes.KeySize / 8);
                    rfc2898.Reset(); //needed for WinRT compatibility
                    aes.IV = rfc2898.GetBytes(aes.BlockSize / 8);

                    //Create Memory and Crypto Streams
                    memoryStream = new MemoryStream();
                    cryptoStream = new CryptoStream(memoryStream, aes.CreateEncryptor(), CryptoStreamMode.Write);

                    //Encrypt Data
                    byte[] data = Encoding.Unicode.GetBytes(dataToEncrypt);
                    cryptoStream.Write(data, 0, data.Length);
                    cryptoStream.FlushFinalBlock();

                    //Return encrypted data
                    return memoryStream.ToArray();
                  
                }
                catch (Exception eEncrypt)
                {
                    return null;
                }
                finally
                {
                    if (cryptoStream != null)
                        cryptoStream.Close();

                    if (memoryStream != null)
                        memoryStream.Close();

                    if (aes != null)
                        aes.Clear();

                }
            }

            public static string Decrypt(byte[] dataToDecrypt, string password, string salt)
            {
                AesManaged aes = null;
                MemoryStream memoryStream = null;
                CryptoStream cryptoStream = null;
                string decryptedText = "";
                try
                {
                    //Generate a Key based on a Password, Salt and HMACSHA1 pseudo-random number generator
                    Rfc2898DeriveBytes rfc2898 = new Rfc2898DeriveBytes(password, Encoding.Unicode.GetBytes(salt));

                    //Create AES algorithm with 256 bit key and 128-bit block size
                    aes = new AesManaged();
                    aes.Key = rfc2898.GetBytes(aes.KeySize / 8);
                    rfc2898.Reset(); //neede to be WinRT compatible
                    aes.IV = rfc2898.GetBytes(aes.BlockSize / 8);

                    //Create Memory and Crypto Streams
                    memoryStream = new MemoryStream();
                    cryptoStream = new CryptoStream(memoryStream, aes.CreateDecryptor(), CryptoStreamMode.Write);

                    //Decrypt Data
                    cryptoStream.Write(dataToDecrypt, 0, dataToDecrypt.Length);
                    cryptoStream.FlushFinalBlock();

                    //Return Decrypted String
                    byte[] decryptBytes = memoryStream.ToArray();
                    decryptedText = Encoding.Unicode.GetString(decryptBytes, 0, decryptBytes.Length);
                }
                catch (Exception eDecrypt)
                {
       
                }
                finally
                {
                    if (cryptoStream != null)
                        cryptoStream.Close();

                    if (memoryStream != null)
                        memoryStream.Close();

                    if (aes != null)
                        aes.Clear();
                }
                return decryptedText;
            }
    #endif

        }

    DVLUP Day–Vancouver / December 7th

    Register Now!Nokia DVLUP Day: November 16 2013, Boston, MA

    https://www.eventbrite.com/event/8993791673

    Join Nokia Developer Ambassador Jan Hannemann and his special guests, fellow Nokia Ambassadors Atley Hunter, Nick Landry, Technical Evangelist Thomas Lewis and Unity expert Jodan Karlik for DVLUP Day at the BCIT campus in downtown Vancouver. The focus of this event is to create BCIT sponsor logo

    Windows Phone apps that qualify for challenges on http://DVLUP.com and receive help in getting it done from some of the top Windows Phone experts. Think of it as a hackathon where everyone wins.

    As an attendee you get the following:

    • A Windows Phone 8. Every attendee who updates or publishes an app within 2 weeks of the event will get a new Nokia Lumia 620 Windows Phone 8 device
    • A heavy-duty swag backpack. The swag bag is chock full of goodies, even the backpack itself is worth $89 (it’s a Wenger, Swiss Gear TSA friendly laptop bag).
    • A Nokia Developer Offers token. This contains the following:
      • Microsoft Windows Phone DevCenter account (this is your portal to publish apps to the Windows Phone Store and also unlocks physical devices for building apps)
      • Telerik RadControls for Windows Phone license
      • Infragistics NetAdvantage for Windows Phone
      • BugSense Performance Monitoring solution for Windows Phone (3 months)
    • 20,000 ad impressions from AdDuplex. In addition, when your app is published you will be entered for
      • 1st place- 1,000,000 ad impressions
      • 2nd place- 500,000 ad impressions
      • 3rd place- 250,000 ad impressions

    Program

    Nokia Developer Programs and AppStudio

    Learn about DVLUP and other Nokia Developer Programs. We will give you all the tools and resources you need to get started with Windows Phone development. You will also learn about AppStudio from Microsoft. It enables you to create your first app without writing one line of code. Even for seasoned developer it is great tool to create quick prototypes or experiment with ideas.

    Introduction to Windows Phone Development

    Learn all the basics about Windows Phone development. XAML, controls, launchers, choosers, etc. All that makes Windows Phone a unique platform and fun to program. If you already know how to code and/or have published apps for other platforms then this will give you a kick-start into Windows Phone development. Once you have started you can’t stop anymore.

    Succeed in the Windows Phone Store

    Improving your apps to succeed in the market is an essential part of the life of any developer on any platform. Learn about the ingredients that are needed for any successful app. Strategies on marketing and monetization that gives you more revenue than just the next cup of coffee. We are happy to share all our little secrets.

    Game Development with HTML5/JS

    Details to be announced. But if you are a HTML/JS developer and love games then this will give you huge boost to the finish line.

    Unity ports

    Unity is available free of charge for Windows Phone 8. This is the perfect opportunity to port your game over to the fastest growing mobile platform. We will have experts and devices on site to help you getting your game running.

    Agenda

    08:00am – 09:00am Registration/Breakfast
    09:00am – 09:15am Introduction to Nokia Developer Programs (Jan Hannemann)
    09:15am – 09:45am Your first app without coding (Jan Hannemann)
    09:45am – 10:00am Coffee Break
    10:00am – 10:50am Getting started with Windows Phone Development (Nick Landry)
    11:00am – 12:00pm Succeeding in the Windows Phone Market (Atley Hunter)
    12:00pm – 01:00pm Lunch Break
    01:10pm – 02:00pm HTML5/JS Game Development (Thomas Lewis)
    02:10pm – 03:00pm Porting Unity Games to Windows Phone (Jodan Karlik)
    03:00pm – Coding starts
    06:00pm – 7:00pm Dinner
    09:30pm – Coding ends

    Developer Environment

    Windows 8 Pro with Hardware Virtualization (Preferred)

    To write native Windows Phone 8 apps, you will need to be using Windows 8 Pro and a PC that supports hardware virtualization. The free Windows Phone 8 SDK can be downloaded here.  https://dev.windowsphone.com/en-us/downloadsdk

    Windows 7/8 without Hardware Virtualization

    Windows Phone 7 apps are welcome as well and the requirements for the development environment are easier to fulfill. The free SDK can be downloaded here  https://dev.windowsphone.com/en-us/downloadsdk Don’t forget to install all the updates up to WP 7.8.

    Developers with a MacBook

    If you are a developer with a MAC, we will have a limited number MAC DEV KIT’s available from Microsoft. This contains a copy of Parallels and a copy of Windows 8 Pro. We will help you setup your mac so that you can develop Windows Phone apps.

    Just a browser

    For developing AppStudio apps all you need is a browser. However, to actually test your app you need a Windows Phone 8 device. But We can help with that. Give it a try http://apps.windowsstore.com/

    A last important note

    You can start coding now! This is not the usual hackathon. First, the actual coding time at the event is very short but you will have 2 weeks after the event to get your app in to the store. However, I recommend to make good use of the experts at the event and get your app as far as possible. The certification time in the WP store is currently 5-7 days. That gives you 2 tries max in case your app gets rejected. Don’t submit your app before the event either. In order to eligible, you need to attend the event and the publish/update date of your app needs be between December 7th and December 21st. Your apps have to pass one of the two DVLUP challenges below. Also games have to be submitted to this challenges and not to the games challenges.

    Any New App Challenge

    Give One Of Your Apps An Update, Any Update…

    If you have questions about your environment, please email nokiaguy@outlook.com

    Special thanks to BCIT for hosting DVLUP Day!

    September Activation

    And the winners are:

    1. Backpack goes to Noe Hwang
    2. Wireless Charging Plate goes to Jodon Karlik

    The summer is almost over and back from the beach it is time to get the compiler busy again. This promotion is for active Windows Phone developer. Active as in, released or updated an app within the last 6 month. So no matter whether you write your first up or deliver the long overdue update to your customers. You will be eligible to enter the drawing for the following prizes.

    Draw prizes

    1 Swiss Army DVLUP Back Pack, 1 Nokia Wireless Charging Plate

    image_thumb15                                700-nokia-wireless-charging-plate-dt-900-with-nokia-lumia-920

    Got active (again)?

    Everyone who published or updated an app in September 2013 and were in-active* before will receive a Nokia Premium Developer Token.

    *has not released or updated an app within the last 6 month

    image

    Can’t code, yet?

    You can’t code or don’t have time? No problem! Microsoft recently released a Beta version of their new app creation tool called AppStudio http://apps.windowsstore.com/. The Beta program is restricted but you can request an invitation code form Microsoft. You will find the link at the registration page. Materialize your idea in 4 easy steps Tutorial

    How to Enter

    Send an email to nokiaguy@outlook.com with subject SeptemberActivation and the following information.

    1. Name
    2. Email Address
    3. Windows Phone Marketplace Publisher Name
    4. Twitter Id (if you have one)
    5. Link to your latest app
    6. DVLUP user name (sign up here http://dvlup.com )
    7. Your location, State/Province and City  
    Rules:

    You must live in one of the following Provinces or States:

    • British Columbia
    • Saskatchewan
    • Alberta
    • Yukon
    • Northwest Territories
    • Washington
    • Alaska
    • Montana

     

    There is more – 920, 925, 928 or 1020?

    For all active developer in US/Canada there is another chance to win a Nokia Lumia flagship device of their choice. Get the details here http://richarddunbar.blogspot.ca/2013/09/september-lumia-blowout.html

    Your first app with no coding

    Microsoft has just launched a new Windows Phone app builder website, Windows Phone App Studio. You can now build a great looking app in no time and earn a free phone from me in the process. You don’t need to be a great programmer, but if you are… you get the source code for the app when you’re done with the template! No other app builder does that for you.

    You still need some incentive to click through a wizard? My WriteOneGetOne  promotion is still on along as my Lumia 800’s last). We also giving away a Lumia 1020 this month. So you better become an active developer now.

    Get Started

    Just a few easy steps to make your first Windows Phone app AND you get to unlock your phone in the process.

    Pick one of 12 templates that best fit your idea. From fitness and sports to inventory and business store fronts.

    Final Step 1 image

    Add some title and description info

    Final Step 2 image

    Now add the content. Get it from a rss stream or add it directly with an easy to use interface.

    Final Step 3 image

    I am adding some of the items I regularly give away to the developer in my region…

    Final step 4 image

    Style the UI with easy to use color selectors

    Final Step 5 image

    Final summary and app generation and you’re almost done..

    Final Step 6 image

    Now just generate the app files, you’ll get a XAP file that you can now side load on your phone.

    Now that you have an easy way to get your first app done, there’s no excuse to not get a free phone on your desk.:)