Implementing advert in Windows Phone app using Nokia NAX with C#

One of the new way of advertising in Windows Phone application is using Nokia NAX. Nokia Ad Exchange (NAX) is a mobile in-app advertising exchange offering access to the top ad networks in the world. With one API and one partner, you’ll get access to over 120 ad agencies and networks worldwide. One of the key concepts for NAX are:

  • Optimization across 120+ ad networks
  • Payment enabled in over 200 countries
  • Manage your own ad campaigns to promote your app
  • Powerful ad performance dashboard
  • NAX is free for developers

Dashboard looks like:

image

Nokia NAX is powered by Inneractive.

So, if you live in country where you can’t use Microsft Ad Exchange, you can easily use NAX to earn some money from your Windows Phone app. You only need PayPal account to get your money.

I’ll show you how to implement location based NAX ad (Banner) in your Windows Phone 8 application.

Step 1 – Register and download SDK

First what you need to do is to register on https://nax.nokia.com.

After that you need to download SDK from SDKs page for Windows Phone 8. Current version is 1.1.3 from 02/14/2013. I propose you  to look at Ad Placement Strategy.html document in folder Documentation with suggestions where to put your advert. From location depends how much will you earn from ad.

Step 2 – Put ad files into Windows Phone project

From InneractiveAdSDK folder of extracted SDK copy files to the root of your Visual Studio project (root because of simplicity, you can put these files in separate folder):

  • Inneractive.Ad.dll
  • InneractiveAdLocation.cs (use this file only if you want to use location based ad in your WP app)

image

and then in Visual Studio for your Project do Add/Existing Item and choose both of the files.

Step 3 – Register NAX add dll file

You need to register Inneractive.Ad.dll file. Use References/Add Reference, click Browse button and find dll file from your Windows Phone solution.

After successful adding of dll file you need to get this reference:

image

Step 4 – Include capabilities

In order to NAX work in your app you need to activate some of the capabilities. From Properties/WMAppManifest.xaml file activate next check boxes in Capabilities section:

  • ID_CAP_LOCATION
  • ID_CAP_NETWORKING
  • ID_CAP_WEBBROWSERCOMPONENT
  • ID_CAP_PHONEDIALER
  • ID_CAP_IDENTITY_DEVICE

Step 5 – Display NAX ad in XAML

First, you need to add control in XAML where your ad will be positioned. We will use nax_control StackPanel using Grid:

<Grid x:Name=”ContentPanel” Grid.Row=”0″ Margin=”12,0,12,0″>     <Grid.RowDefinitions>         <RowDefinition Height=”*”/>         <RowDefinition Height=”53″/>     </Grid.RowDefinitions>      <ListBox Grid.Row=”0″>     </ListBox>                  <StackPanel Height=”53″ Name=”nax_control” Grid.Row=”1″>     </StackPanel> </Grid>

List of Supported ad sizes:

  • 300 x 50
  • 320 x 53
  • 300 x 250 (Rectangle)
  • 320 x 480 (Full Screen)

We will use 320×53 pixel size on the bottom of the page using Grid.

The final result is:

NAXOnPage

Step 6 – C# code for NAX

After adding control in XAML code we need to write some code using C#. First we need to add two namespace in page where we want to put our ad control, in this case MainPage.xaml.cs with:

using Inneractive.Nokia.Ad;
using InneractiveAdLocation;

I would suggest to include namespace:

using Microsoft.Phone.Net.NetworkInformation;

NetworkInformation is to check if internet connection is available with method: DeviceNetworkInformation.IsNetworkAvailable.

Then define optionalParams before main constructor in the class. All logic are in two methods:

  • MainPage_Loaded
  • iaLocation_Done
public partial class MainPage : PhoneApplicationPage
{
  Dictionary<InneractiveAd.IaOptionalParams, string> optionalParams;

  // Constructor
  public MainPage()
  {
    InitializeComponent();

    // Sample code to localize the ApplicationBar
    this.Loaded += new RoutedEventHandler(MainPage_Loaded);
  }

  private void MainPage_Loaded(object sender, RoutedEventArgs e)
  {
    if (DeviceNetworkInformation.IsNetworkAvailable)
    {
      // Watch location
      IaLocationClass iaLocation = new IaLocationClass();
      iaLocation.Done += new System.EventHandler(iaLocation_Done);
      iaLocation.StartWatchLocation();

      optionalParams = new Dictionary<InneractiveAd.IaOptionalParams, string>();
      optionalParams.Add(InneractiveAd.IaOptionalParams.Key_OptionalAdWidth, "320"); //ad width
      optionalParams.Add(InneractiveAd.IaOptionalParams.Key_OptionalAdHeight, "53"); //add height
    }

    //Show Add Banner. Remarks: pay attention to use Application Id from NAX
    if (optionalParams != null)
    {
      InneractiveAd iaBanner = new InneractiveAd("ApplicationId_NAX", InneractiveAd.IaAdType.IaAdType_Banner, 30, optionalParams);
      nax_control.Children.Add(iaBanner);
    }
  }

  void iaLocation_Done(object sender, IaLocationEventArgs e)
  {
    try
    {
      // Add location, if received
      if (e != null && e.location != null)
      optionalParams.Add(InneractiveAd.IaOptionalParams.Key_Gps_Coordinates, e.location);
    }
    catch (Exception ex)
    {
      System.Diagnostics.Debug.WriteLine("Error: " + ex.ToString());
    }
  }
}

Remarks: ApplicationId_NAX is generated from nax.nokia.com from Add App section.

image

You need to enter some of the information such as:

  • Mobile platform
  • Application name
  • Category
  • Does your app use location

After this you get generated Application Id for you application. This is crucial info to track your ad banner in your Windows Phone app in Nokia NAX dashboard.

Generated Application Id (AppID) that you need to use in your app (we call it ApplicationId_NAX in our app):

image

I hope that you can earn some money using Nokia NAX ad.

Posted in Programming, Windows Phone | Tagged , | 9 Comments

WinDays 13 Technology Conference Report

Unfortunately, everything that is beautiful has it’s end. That is true for WinDays13 Technology conference also. I’m very happy that I was part of the biggest conference in the SEE region, Croatia, town Umag located on Istra peninsula.

image

As many of the attendees said, this was the best WinDays conference ever. This was my first WinDays conference so I must admit that I was really surprise how well this conference was organized. It is really big, with over 1500 attendees, with over 130 speakers, fantastic accommodation, beautiful Adriatic coast (one of the most beautiful in the Europe), interesting old town Umag, fantastic weather during three days, delicious local cuisine, oportunity to see my good IT friends from the region. So what else anyone can wish at one IT conference.  Thanks to Microsoft Croatia for fantastic conference.

I have one session on third day of the conference. My accepted session was “Building business application using Visual Studio LightSwitch”. I have only 45 minutes to show how easy is to build some parts of the business app using fantastic tool as Visual Studio LightSwitch using C#. Beside Silverlight desktop or web client, in Visual Studio Update 2 it is possible to build touch-oriented business applications that run well on modern mobile devices using C#, HTML5 and JavaScript.

One of the key concepts that I presented were:

  • Main architecture of LightSwitch
  • Main concepts (screen, entity, relation, data source, query, template for screen)
  • Creating entities and relation
  • Creating screens using templates
  • Creating business logic
  • Creating permissions on screen or entity level
  • Publishing LightSwitch application

You can find presentation slides and document with steps on official web page of the conference or on skydrive here.

I have crowded room. You can see how well this was ended with this happy picture from my session:

IMG_1115

To show you some details about the conference and everything else related with Umag please look at the next pictures:

IMG_1071Spaso_WD13_Official_Picture_24.04.2013

IMG_1160IMG_1088

IMG_1199IMG_1219

IMG_1022IMG_1027

IMG_1168IMG_1223

IMG_1046 (Custom)_1
Until next WinDays conference, see you.

Posted in Conference | Tagged | Leave a comment

Microsoft conference announcement MSNetWork 3 and WinDays13 Technology

The two big Microsoft conferences in southeast Europe region will be held in April 2013:

MS NetWork 3 – Bosnia and Herzegovina (http://www.msnetwork.ba)

WinDays 13 Technology – Croatia (http://www.windays.hr)

300x300image

I’m really happy that I will be speaking at both conferences with two different sessions.

MS NetWork 3

03. April – 04. April 2013, Banja Vrućica, Teslić, Bosnia and Herzegovina

Hotel Kardial-Banja Vrucica

This conference is being held for the third time and it is the youngest in region. With top quality sessions held by more than 20 MVPs and more than 50 speakers it will be a really promising event. When we took into consideration hospitality of the hosts of Banja Vrućica tourist resort which is situated near city of Teslić (50 km from Banja Luka), Republic of Srpska, Bosnia and Herzegovina, MS NetWork is a rising star in conference events of the region, concerning technology.

Event will be divided into six tracks:

  • Business (BIZ)
  • IT Pro (PRO)
  • Developer (DEV)
  • Microsoft Community (MSC)
  • Education (EDU)
  • Community (CS)

This event is a great networking opportunity and provides atmosphere for bonding on both levels personal and business as well as to discuss the technology novelties from the IT world.

I’ll be giving one session at MS NetWork conference on 3rd April on DEV track:

Developing Windows Phone application from A to Z

Some of the abstracts for my presentation are:

  • How to get idea for new Windows Phone app
  • Main tools for building Windows Phone apps
  • Using serialization for storing data in Isolate Storage
  • Using new MAP control
  • Using voice commands
  • Using Tiles
  • Main consideration when deploying app to Windows Phone Dev Store

You can find official info about session here.

You can find more info about conference at http://www.msnetwork.ba or you can use official hash tag #msnetwork3 on twitter.

This conference is special for me because I’m author of official Windows Phone app for MSNetWork 3:

ss1_WVGAss3_WVGAss6_WVGA

You can find MSNetWork 3 here:

windows-phone

WinDays 13 Technology

22. April – 25. April 2013, Umag, Croatia

Umag1

WinDays is the biggest and oldest conferences in ex Yu. It will be held in Umag, city on the Adriatic Coast which gives this event high class star due to very high position of Croatian tourism in the rich European tourist offer.

I’ll be giving one session at WinDays 13 conference on 24th April  on DEV track:

Building business application with Visual Studio 2012 LightSwitch

In this presentation I’ll show in 45 minutes session how (oh, this will be tough) to create business application which have all characteristics of modern programming concept (MVVM, WCF RIA Services, Entity Framework, 3-tier app, possible to deploy on IIS or Windows Azure).

Some of the abstracts for my presentation are:

  • Main architecture of LightSwitch
  • Main concepts (screen, entity, relation, data source, query, template for screen)
  • Creating entities and relation
  • Creating screens using templates
  • Creating business logic
  • Creating permissions on screen or entity level
  • Publishing LightSwitch application

You can find official info about session here.

Official hash tag for WinDays 13 is #WinDays

See you there!

Posted in Microsoft Conference | Tagged , | Leave a comment

Windows Phone application success story – Picture Info

When you read my title you probably mean that success means money. Not this time but the fact that my application Picture Info is among ten (10) top free Windows Phone application in Social category in Windows Phone Store (USA) makes me proud and happy.

image

When I took this screen shoot last night, I was even on better position then official Twitter application which is really amazing (it is among 110 top free app in all category at the moment of writing this blog post). The total number of applications in Windows Phone Store is more than 120.000 apps.

PictureInfo

You need to know that position in top app is changing on daily basis and it depends on a lot of factors such as number of downloads in some period, rating, number of crashes etc.

What is Picture Info?

Picture Info is simple application that extend Picture Hub functionality by providing picture meta data that can be read from exif data attached to picture. Application provide picture data that operating system would normally do, but that is not implemented even in Windows Phone 8 so you need to use third party application such as Picture Info to do that.

Application is created for the Nokia program – The Metro Developer Show – FREE Nokia Phone & App Hub Subscription organized by Nokia Ambassador Rich Dunbar. I even earned Nokia Lumia 800 in this program. After that I participate in DVLUP with this app and the other app that I created for this challenge and earned also some prizes too.  I have been trying to constantly do updates according to user’s demands so application is very popular and have really good ratings. One of them depicts my efforts to do my best in creating useful Windows Phone application:

“This is the best EXIF data viewer on the marketplace! The developer has demonstrated amazing responsiveness in improving the app according to feedback he has received.” – by Eric.

Picture info has separate installment for Windows Phone 7.5 and Windows Phone 8 devices.

At the time of creating this application I put it in Social category but really true category would be Tools and Productivity but I don’t want to change it now.

So, if you want to find out when you take your picture, location of the picture, exif data such as Iso Speed, Exposure time, F-stop, GPS Altitude, GPS coordinates, Focal Length etc., you can use Picture Info.

5f527079-d34f-495f-922e-08617f168f16

You can grab it from Windows Phone Store using QR Code:

Picture_Info_20133613810

You can find all my Windows Phone app here.

Posted in Windows Phone | Tagged | Leave a comment

Grouping XAML and code-behind file in Visual Studio

If you work with projects (Windows Phone app, Windows 8 app) that have XAML files using Visual Studio you noticed that xaml and code-behind files are grouped as follows:

image

But what if we have situation when XAML and code-behind file are not connected like this:

image

So, first I would explain how this grouping is obtained and then explain how to fix it if it is broken.

If we look at one page, i.e. PageOne in Windows Phone app it consist of XAML that is .xaml file and code-behind files .cs (if we use C# as programming language). When you are in the XAML file you can go to code-behind file with View Code command from context menu (F7):

image

When you are navigated to code-behind you can go back to XAML file with View Designer (Shift + F7):

image

Visual Studio helps this grouping on two places. In XAML the location of the XAML code-behind file is identified by specifying a namespace and class as the x:Class attribute of the root element of the XAML (PageOne.xaml):

<phone:PhoneApplicationPage
x:Class="TestProject.Pages.PageOne"
....
</phone:PhoneApplicationPage>

XAML content is treated as partial class definition for a class PageOne (with TestProject.Pages namespace) derived from PhoneApplicationPage.

On the other side, Visual Studio set dependencies for code-behind files using .csproj project file:

image

<ItemGroup>
....
  <Compile Include="Pages\PageOne.xaml.cs">
    <DependentUpon>PageOne.xaml</DependentUpon>
  </Compile>
....
</ItemGroup>

But what if this grouping of files are damaged. We can get this situation if we make copy of xaml and code-behind files in Windows explorer (from PageTwo make PageThree):

SNAGHTMLb6d65df

The point is that using existing page – PageTwo make copy then rename to PageThree and make some modification in files (real life scenario). First in xaml file change:

SNAGHTMLb8c13f9

then in code-behind file .cs rename PageTwo to PageThree:

SNAGHTMLb8f9a29

As a result, after adding existing files from folder Pages in solution explorer:

image

we have situation in Project:

image

Note that PageThree files (xaml and .cs) are not grouped as other pages (PageOne and PageTwo). One of the result of this situation is that you don’t have navigation from .cs file to .xaml file with View Designer-F7:

image

How to Fix this?

Easily, by changing TestProject.csproj file by adding DependentUpon element in xml file from:

<Compile Include="Pages\PageThree.xaml.cs" />

to:

<Compile Include="Pages\PageThree.xaml.cs">
  <DependentUpon>PageThree.xaml</DependentUpon>
</Compile>

After fixing csproj file we have in solution explorer in Visual Studio:

image

Navigation from code-behind file are now possible:

image

Remarks: If you don’t fix this in non-grouped project files by changing csproj file by adding DependentUpon element, you will be able to navigate from .xaml file to .cs file and then from .cs file to .xaml file, but you can’t navigate if you have only .cs file opened and then try to navigate to correspondent .xaml file).

Whenever you add a page to a Visual Studio project (using Add New Item), Visual Studio automatically creates a XAML file (.xaml) with x:Class on its root, creates the code-behind source file with the partial class definition (.cs), and links the two together so they are built properly.

Posted in Programming | Tagged , | 2 Comments

MVP Summit 2013 Report

Actually this would not be true report from MVP Summit 2013 because all information that we as MVP can hear at the summit can’t be shared to anyone because of NDA (Non-disclosure agreement). But I can share all the other info that are not releated strictly to Microsoft and NDA. So, first things first. What is MVP, what is MVP Global Summit and where it takes place?

Microsoft every year (four times)  give an award to exceptional people who voluntarily shared their knowledge on Microsoft products. Whether it’s an online forum or a technical speech, the Microsoft MVPs are independent people who gained the trust of their peers by facts. It’s about communities, it’s about sharing the personal/professional experience they acquired on the field (excerpt from MVP lead for CEE & Italy – Alessandro Teglia).

MVP Global Summit is annual MVP meeting where MVPs from all over the world participate in specific conference where Microsoft Development teams for various products (mostly product manager are speakers) receive feedback from MVPs and also provide information close to Microsoft products to MVPs. Exchange of information are at sessions that Microsoft speaker held and at parties and side session activities.  This year, MVP Summit was hosted in Bellevue (10 minutes from Redmond and about 30 minutes from Seattle using bus) and at Microsoft headquarters in Redmond, Washington, USA from 17th to 21st February.

As part of Bosnian MVP team (Bahrudin Hrnjica – C#, Adis Jugo – SharePoint;  and I - Spaso Lazarevic – C#) I was able to attend MVP Summit for the first time. Luckily, I have a lot of useful information from previous summit from my dear friends from Bosnia and Herzegovina and Croatia. As time to flight was approaching, excitement was rising from day to day. Finally, after a long trip over Frankfurt (Germany) and 10 hours flight with Lufthansa we came to the United States of America. Also, need to mention that we have a lot of MVPs from Germany in the plane (a lot of Geeks in one plane). And when we land on the USA soil, I wasn’t stop to be thrilled from day to day with organization of all aspect of life in USA, but really. That is land where even cleaning stuff has headset (microphone and headphone) when doing their job (I was asking myself why, probably they got right information that there is a tiny speck of dust to be removed urgently from the sector 1345.125 – well this is my version).

In America everything is BIG. Besides Big Mac, everything is big, buildings, highways, number of people, number of cars. So much things that someone who came from Europe wasn’t accustomed to. For instance, imagine situation that because of jet lag you can’t sleep anymore, say at 4.00 a.m. And if you look outside the window of your hotel room you can find that a lot of people have some sort of exercises in the gym hall across the hotel. Strange, isn’t it? In USA, activities never stop even in that early hours.

Picture 1 and 2: Bellevue

MVP Summit 13-1MVP Summit 13-2

Ex Yu countries (Bosnia and Herzegovina, Serbia, Croatia, Macedonia and Slovenia) have four MVPs for C# and on the summit there are only three (Bahrudin Hrnjica left, Bernandin Katić in the middle and me on the right).

Picture 3: C# MVP

MVP Summit 13-3

MVP summit is really great place to meet other MVPs and also to have contact with IT celebrities such as Beth Massi, Scott Hanselman and Scott Guthrie:

Picture 4: Beth Massi; Picture 5: Scott Hanselman: Picture 6: Scott Guthrie

MVP Summit 13-4MVP Summit 13-5MVP Summit 13-6

I was really happy, and hard to explain how happy I was, for having the opportunity to be close with these IT experts that I admire and which work I follow during these years. Opportunity to be close to these people is tremendously precious for me. Also, that feeling when you are talking with product manager for some Microsoft products about your experiences using that products is really strange. Meeting people who are activally involved in creating that product is almost unreal for me until summit event.

Picture 7: MVPs from CEE & Italy region

MVP Summit 13-7

Yes, it was hard but worth it every penny (some of the expenses are covered by Microsoft but some are not).  Networking is really what you need if you want to stay live in this hard IT job.

There are a lot of good memories that are still fresh but these are that come out of me right now. That good memories would not be so good that I didn’t have so good friends (they now who they are) who share with me all interesting things at the summit.

Note 1: My report wouldn’t be complete without details that explain my good friend Romeo Mlinar on his blog post MVP Global Summit 2013 – It was nice, it was good!

Note 2: I’m really proud and happy that Microsoft choose this blog post and publish it into famous MVP Friday Five blog posts on The Microsoft MVP Award Program Blog – Friday Five – 2013 MVP Summit Report.

Posted in Community | Tagged | 9 Comments

Windows Phone SDK 8.0–šta je novo

Article name: What’s new in Windows Phone SDK 8.0

This article has been published in Info IT magazine released in February 2013, number 181 (BH IT magazine -http://info.ba). Article language: serbian, bosnian, croatian.

Tekst je izašao u februarskom broju Info za 2013 (BH Informatički magazin) – http://info.ba broj 181:

naslovna-181

Kompanija Microsoft je početkom novembra izdala novu Windows Phone 8.0 platformu koja ima značajna unapređenja u odnosu na pređašnju verziju te se kao najbrže rastuća platforma nametnula kao izbiljan igrač u svijetu mobilnih platformi. Ono što vam je potrebno kao programeru, kako bi kreirali nove Windows Phone 8 aplikacije, je da instalirate Windows Phone SDK 8.0. Windows Phone SDK 8.0 sadrži niz novih alata za razvoj,  debagiranje i testiranje aplikacija.

C++

Uvedena je mogućnost korišćenja C++ jezika u fazi razvoja Windows Phone aplikacija što je inače bio zahtjev velikog broja programera. Razlog je veoma jasan, C++ se može koristiti za razvoj mobilnih aplikacija na drugim platformama te se može iskoristiti veliki dio poslovne logike koju su programeri koristili za razvoj  na drugoj platformi ali i dio funkcionalnosti koji je pisan pomoću C++ za open source projekte. Moguće je C++ koristiti za razvoj Windows Phone 8 aplikacija koje koriste XAML kako u C# tako i u Visual Basic programskim jezicima ali je takođe moguće da aplikaciju u potpunosti kreirate isključivo pomoću C++.

Razvoj Direct3D aplikacija

Windows Phone 8 omogućava programerima korištenje nove platforme za razvoj 3D igara pomoću C++: Direct3D. Novi aplikacioni model omogućava pristup niskog nivoa Direct3D API-ju za grafiku, XAudio2 i WASAPI za audio. Takođe novi model omogućava da se kao odredišna platforma izabere Windows 8. Nova C++ platforma će omogućiti korištenje popularnih alata za kreiranje igara kao što su: Unity3D, Havok, FMOD, Audiokinetic Wwise i Autodesk Scaleform što bi značajno trebalo da omasovi kreiranje igara za Windows Phone 8 platformu. Direct3D aplikacije su pisane u native code, značajno su teže za programiranje ali su namijenjene za aplikacije od kojih se očekuju visoke perfomanse kao što su složene 3D igre.

XAML kontrole

Kontrole koje je moguće u Windows Phone 8 i koje su doživjele unapređenja u odnosu na prethodnu verziju ili su kreirani od početka su:

  • Map kontrola. Kontrola koja je kreirana od početka i koja koristi Nokia mapping engine obezbjeđuje podršku za off-line pristup mapama i podatke prikazuje u vektorskom obliku za kvalitetniji prikaz podataka bez obzira na nivo uvećanja mape. Korištenjem skupa alata za mape-Maps API, moguće je kreirati aplikacije koje koriste mape i u okviru kojih je moguće vršiti pretraživanje kao i prikaz podataka na osnovu upotrebe lokacijskog servisa na telefonu.
  • WebBrowser kontrola. Kontrola bazirana na Internet Explorer 10 verziji koja omogućava prikaz CSS3 i HTML5 sadržaja a za brži odziv se koristi hardverska akceleracija.
  • LongListSelector kontrola. Kontrola koja se koristi za prikaz liste podataka u okviru Windows Phone aplikacije. Omogućava grupisanje podataka i prikaz zaglavlja za grupu podataka, podršku za jump list koja pomaže u navigaciji (osobina koja olakšava navigaciju u listi pristupom određenoj sekciji liste), grid rapored elemenata za prikaz sadržaja kojeg čine umanjene slike (thumbnails) kao i skup događaja za prikaz podataka u beskonačnoj listi (lista koja se konstantno dopunjuje novim podacima na svom kraju).

Perfomanse kontrola su značajno unaprijeđene, tj. odziv kontrola je brži i kontrole koriste manje memorije za svoj rad  (na primjer Panorama kontrola koristi 50% manje memorije nego u prethodnoj verziji). Interesantna je činjenica da su kontrole Pivot i Panorama uklonjene iz SDK i da su postavljene u dio memorije telefona koji je moguće samo čitati (ROM). Na ovaj način mnogo je učinjeno na brzini odziva aplikacije prilikom korišćenja Pivot i Panorama kontrola. ProgressBar kontrola se sada izvršava u posebnoj niti (thread) što utiče na kvalitetnije izvršavanje aplikacije.

Rezolucija ekrana

Windows Phone 8 podržava tri rezolucije:

  • WVGA 480×800 px (odnos 15:9, skalirana rezolucija 480×800). Ovo je rezolucija koju podržava Windows Phone OS 7.1
  • WXGA 768×1280 px (odnos 15:9, skalirana rezolucija 480×800)
  • 720p 720×1280 px (odnos 16:9, skalirana rezolucija 480×853)

S obzirom da postoje 3 različite rezolucije sa dva različita odnosa 15:9 i 16:9 izuzetno je bitno da se prilikom razvoja Windows Phone 8 aplikacija vodi računa o rasporedu kontrola na stranici aplikacije tačnije da se ne vrši zakucavanje vrijednost za visinu i širinu kontrola. Za rješavanje ovog problema se savjetuje korištenje kontejner kontrole Grid i korištenje * i Auto za određivanje visine i širine redova i kolona. Na ovaj način će razvlačenje kontrola u dvije dimenzije biti odgovarajuće u odnosu na veličinu ekrana vašeg telefona.

Različite rezolucije Windows Phone 8 mogu uticati i na grafičke elemente u okviru aplikacije kao što su pozadinske slike, ikone, splash ekran, pločice i ikonice za ekran sa spiskom aplikacija. Naime, preporuka je da se za sve ove elemente kreiraju grafički elementi za rezoluciju WXGA koja ima najbolji kvalitet a sam telefon će odraditi skaliranje za ostale rezolucije. Ukoliko želite da za različite rezolucije imate savršen izgled vaših grafičkih elemenata koje odgovaraju rezoluciji telefona koja nije WXGA onda je potrebno obezbijediti posebno fajlove za ostale rezolucije. Tako je za splash ekran potrebno samo obezbijediti 3 različita fajla sa određenim nazivom dok za pozadinske slike treba obezbijediti slike za sve rezolucije i kroz kod izvršiti prepoznavanje koju rezoluciju telefon podržava. Primjer upita da li telefon podržava WXGA rezoluciju:

App.Current.Host.Content.ScaleFactor == 160;

Lančeri

Novi lančeri (Launchers) koji predstavljaju način za jednostavno pozivanje određenih funkcionalnosti u okviru Windows Phone 8 telefona su:

  • SaveAppointmentTask. Omogućava da se pokrene aplikacija za kalendar sa opcijom za unos termina novog sastanka (new appointment).
  • MapDownloaderTask. Pokretanje podešavanja za mapu i koristi se za download podataka za mapu za offline korištenje.
  • MapsTask. Omogućava pokretanje aplikacije za mapu sa centrom u lokaciji određenoj pomoću atributa Center ili da u centru mape bude prikazana trenutna pozicija korisnika telefona.
  • MapsDirectionsTask. Pokretanje aplikacije za mapu koja prikazuje instrukcije za kretanje ukoliko se obezbijede početna i/ili krajnja lokacija
  • ShareMediaTask. Pokretanje dijaloga koji služi za izbor tipa dijeljenja multimedijalnih sadržaja na socijalnim mrežama.

Novčanik i kupovina u okviru aplikacija

Nova mogućnost predstavljena u Windows Phone 8 je novčanik (Wallet). Pomoću novčanika možete na jednom centralizovanom mjestu na telefonu čuvati informacije o kreditnim karticama, kuponima, članskim kartama, čuvati informacije koje pomažu prilikom kupovine aplikacija i muzičkih sadržaja na Windows Phone Store, odraditi kupovinu pomoću bezkontaktnog pristupa (Near-Field Communication-NFC) ili obaviti kupovinu u okviru aplikacije (in-app purchase). Putem Windows Phone 8 aplikacija korištenjem Wallet API moguće je pristupiti svim stavkama novčanika i vršiti bilo koju vrstu  manipulacije nad podacima kao što su kreiranje, čitanje, upisivanje i brisanje. Jedna od ključnih osobina novčanike su agenti (Wallet Agents). Agenti omogućavaju programerima da dinamički vrše izmjene stavki u novčaniku ali mogu biti korišteni da prikažu određene informacije u vidu poruka (stanje računa za određenu karticu ili prikaz informacija o posebnoj ponudi ili popust na određene proizvode).

Takođe, Window Phone 8 je predstavio novi način kupovine, kupovinu u okviru aplikacije (in-app purchase). Za programera to znači da je moguće u okviru aplikacije prodavati digitalne stvari kao što su: avatar, elektronska knjiga, otključavanje određenog nivoa igre, iznajmljivanje video materijala, prodaja virtuelnog novca kao što su zlato ili kovanice. Korisnik vrši kupovinu na način kao što kupuje aplikacije korištenjem kreditne kartice ili PayPal naloga. Nakon kupovine, Microsoft obezbjeđuje elektronski dokaz o načinjenoj kupovini sa svim relevantnim podacima koji određuju datu kupovinu.

Komunikacija između uređaja

Windows Phone 8 je uveo novi način komunikacije između Windows Phone 8 telefona pomoću Proximity API. NFC standard omogućava komunikaciju između uređaja i ovaj standard je zadužen za funkcionisanje Proximity API (proximity znači blizina na engleskom jeziku). Osnovne karakteristike NFC su komunikacija između uređaja na malim međusobnim rastojanjima (3-4 cm) sa brzinama protoka od 30 kbits/s do 60 kbits/s.

Proximity API se može koristiti za sledeće situacije:

  • Povezivanje uređaja. Ostvarivanje veze između vaše aplikacije na vašem telefonu i instance vaše aplikacije na drugom telefonu putem Wi-Fi ili Bluetooth konekcije.
  • NFC tagovi. Telefon se može koristiti za čitanje sadržaja koji sadrže NFC tagove.
  • Razmjena digitalnog sadržaja. Omogućava slanje podataka sa jednog na drugi telefon kako bi se na primjer razmijenili kontakt podaci u obliku poslovne kartice (vCard).

Na telefonima koji imaju NFC čip, korisnici mogu ostvariti prethodne scenarije povezivanja ili razmjene podataka  jednostavnim međusobnim dodirivanjem telefona.

Lock ekran, pločice i notifikacija

Windows Phone 8 omogućava da se za bilo koju Windows Phone 8 aplikaciju postavi notifikacija na Lock screen. Da bi to bilo moguće, potrebno je u aplikaciji u manifest fajlu dodati ovu mogućnost notifikacije i potrebno je obezbijediti ikonicu koja će predstavljati ovu funkcionalnost. Uključivanje notifikacije je moguće programski, iz vaše aplikacije, ili kroz podešavanja u okviru telefona u okviru settings\lock screen ekrana. Pored notifikacije, moguće je u okviru Windows Phone 8 aplikacije odabrati da se vaša aplikacija ponaša kao provajder za sliku koja se potom postavlja kao pozadina na lock screen. Sistem postavljana je istovjetan kao i za notifikaciju.

Windows Phone 8 dolazi sa novim veličinama pločica (Tiles) kao i sa novim šablonima za rad sa ovim pločicama. Pločice predstavljaju vašu aplikaciju na početnom ekranu (Start screen) i pojavljuju se kada korisnik sa spiska aplikacija na telefonu odradi akciju pinovanja (pinovanje aplikacije je moguće i kroz aplikaciju). Šabloni koji se koriste za pločice su: Flip, Cycle i Iconic. Veličine pločica za rezoluciju WXGA su small (159×159 px ili 1×1), medium (226×226 px ili 2×2) i wide (691×336 px ili 2×4) i za svaku veličinu je potrebno obezbijediti odgovarajuću sliku u okviru aplikacije. Kako Windows Phone 8 podržava pored WXGA i druge dvije rezolucije WVGA i 720p sam operativni sistem vrši skaliranje slika koje ste obezbijedili za svaku od pločica sa rezolucije WXGA na odredišnu rezoluciju vašeg telefona

Podrška distribucije kompanijskih aplikacija

Windows Phone 8 omogućava distribuciju aplikacija unutar kompanije te je ovim Windows Phone 8 platforma postala ozbiljan igrač u oblasti upotrebe mobilnih uređaja za biznis.  Telefoni kojima se dodjeli privilegija za pristup kompanijskim aplikacijama koji se nalaze na centralnom skladištu aplikacija Company Hub mogu instalirati aplikacije koje kompanija ima da ponudi za svoje zaposlene. Company Hub je vlasništvo isključivo kompanije i nema nikakve veze sa Windows Phone Store. S druge strane, kompanija zadržava pravo kontrole nad telefonima koji pristupaju Company Hub i ako je to potrebno moguće je da se izvrši brisanje svih podataka koji su vezani za kompaniju pri čemu se ne diraju ostali podaci sa telefona zaposlenog. Preduslovi za ostvarivanje pogodnosti postavljanja i distribucije aplikacija za zaposlene je da kompanija registruje nalog na Windows Phone Dev Center i zatraži kompanijski sertifikat od firme Symantec. Potom se kreira token koji služi da se potpišu aplikacije koje će biti postavljene na Company Hub. Aplikacije se postavljaju na sigurnu lokaciju kao što je sigurni web sajt kome kompanijski telefoni mogu pristupiti ili se aplikacije postavljaju na server gdje se postavljaju XAP fajlovi i kojima se pristupa putem servisa. Kompanija pored kreiranja aplikacije kreira i Company Hub čija je uloga pretraga kompanijskih aplikacija sa sigrune lokacije kao i instalacija tih aplikacija.

Windows Phone 8 Emulator

Windows Phone Emulator je desktop aplikacija koja emulira Windows Phone uređaj. Emulator vam nudi virtuelno okruženje koje zamjenjuje fizički uređaj i pomoću koga možete testirati vašu aplikaciju ali je preporuka da se prije postavljanja aplikacije na Windowsw Phone Store aplikacija testira i na stvarnom telefonu. Za pokretanje emulatora je potrebno da vaš računar podržava vitruelizaciju što neće biti izvodivo za malo starije računare. Emulator se pokreće pod Windows Hyper-V virtuelnom mašinom koja zahtjeva iste hardverske i softverske mogućnosti koje je potrebno da ispuni vaš računar kao za Hyper-V. Ukoliko vaš računar ne podržava rad emulatora i dalje ćete moći razvijati aplikacije za Windows Phone 8 ali ćete u tom slučaju morati testirati aplikaciju na Windows Phone 8 telefonu.

StartScreen-Emulator

Manifest dizajner

U novom okruženju je moguće mijenjati podatke u app manifest fajlu kroz set ekrana kreiranih u grafičkom korisničkom interfejsu za razliku od prethodne verzije kada je bilo moguće mijenjati podatke u xml fajlu koji je bio prikazan u tekstualnom obliku.

AppManifest

Posted in IT Magazine, Windows Phone | Tagged | Leave a comment