Coding Paradox

Blog On .Net, CSharp, Windows Phone Programming

Archive for the ‘Windows Phone’ Category

Calling Web Service from Windows Phone 8 App

without comments

In this post we will take a look at how to call a web service from a Windows Phone 8 app and retrieve data in JSON format. We will be calling a simple REST web service from our sample application to retrieve the latest weather information and display the same.

Web Service

We will be using the weather API provided by The Api is simple and free to use and provides current weather information as well as weather forecast from the next few days. The api provides various options to get the weather information based on Location, Pin Code, Latitude/Longitude coordinated etc. We will be using the below mentioned api call to get the weather forecast data for a week based on Pin Code. Read the rest of this entry »

Written by Mako

October 22nd, 2014 at 10:57 am

Updating App Tile using Background Agent in Windows Phone 8 App

with one comment

Background Agents and Scheduled Tasks allows your application to execute to code in the background even when the application is not running in the foreground. This is quite useful in various type of scenarios where you want to update the Live Tile frequently, show a toast notification on getting some data from web service, perform some data synchronization etc. In this tutorial we will take a look at how to use Background Agent to update the app tile in Windows Phone 8 application.

The Windows Phone API includes the ScheduledTaskAgent class which can be used to create Background agents which run on periodic schedules. Two types of tasks can be created which are

  • PeriodicTask : This is useful for scenarios which require small time to execute. This is run once every 30 minutes are useful for performing tasks like raising notifications, updating tile etc.
  • ResourceIntensiveTask : This is useful when performing operations which require a long amount of time. This tasks executes for 10 minutes however there are a lot of criteria related to processor activity which must be fulfilled before the task is executed. You can use this while performing lengthy operations like synchronizing data or uploading pictures.

A Windows Phone application can have only one background agent but it can register both PeriodicTask as well as ResourceIntensiveTask. If an application registers both the type of tasks, there are both executed at different intervals. The tasks can use a limited amount of memory which is around 11 MB at a given time. If memory usage increase, the task is immediately terminated. If the agents terminated two consecutive times due to unhandled exceptions, they are automatically removed from schedule. Read the rest of this entry »

Written by Mako

June 1st, 2014 at 3:26 pm

Using Local Database in Windows Phone Apps

without comments

In my previous posts, we looked at how to store data in Windows Phone Apps using Local Storage and Isolated Storage. In this post we will take a look at how to create a Local Database for storing data of our Windows Phone app. Database are great storage option when your app want to store some relational data. The database gets created into the local app folder and is only accessible to the same application.

We will be using the LINQ to SQL assembly and mainly the classes present in the System.Data.Linq and System.Data.Linq.Mapping namespace to create our database schema and perform CRUD operations on it.

In this demo, we will create a sample application that will store Students Information in the database. For each student, we will also store the courses that the student has taken. Lets get our hands dirty.

Open Visual Studio –> New Project –> Windows Phone Blank App and name the application “LocalDatabaseWPApp”.

Read the rest of this entry »

Written by Mako

May 12th, 2014 at 5:40 pm

Using Isolated Storage in Windows Phone App

without comments

In my previous post, we looked at how to use local storage in Windows phone to save the data. In this post, we will look at another way of storing the data locally using IsolatedStorage. In most of the applications that we develop, we will need some way to save ‘Settings’. IsolatedStorage is quite useful in that scenario as we can easily save/retrieve settings from that.

Isolated Storage provides a way to store data locally in the file system. It is called ‘isolated’ as only your application has access to the data. There are two ways in which data can be stored in IsolatedStorage. We can store the data as Name/Value settings using IsolatedStorageSettings and you can also save normal files using IsolatedStorageFile. Data present in IsolatedStorage is persisted even when the application is stopped, tombstoned or closed or even if the phone is switched off. Data is going to be present unless it is removed manually or the application is uninstalled. Read the rest of this entry »

Written by Mako

May 3rd, 2014 at 1:52 pm

Working With Local Storage in Windows Phone App

with 2 comments

In almost all the apps that are developed, some sort of data needs to be stored on the device either temporarily or permanently. There are lots of options of storing data when working on Windows Phone platform. In my earlier tutorials, we looked at how to create a simple Windows Phone app and performing page navigation. In this post, lets take a look at how to Read and Write files to the Local Folder in Windows Phone.

Open Visual Studio 2013/2012 and Create a New Windows Phone App project and name it “LocalStorageWpApp”. We will be creating a small application where we will read and write contents in a local file on Windows Phone.

Once the default solution is create, open MainPage.xaml and rename the page title to say “Local Storage”. Add the below XAML code to the ContentPanel Grid.

Read the rest of this entry »

Written by Mako

April 17th, 2014 at 6:47 pm

Performing Page Navigation in Windows Phone Apps

without comments

In the previous article, we learned the basics of creating a simple Windows Phone app. In this post, we will look at how to perform navigation between different pages in Windows Phone app. We will use the same Visual Studio solution used in the previous post and continue from there.

Open the MyFirstWPApp solution in Visual Studio. We will be adding a new page in our solution to which we can navigate to. Right Click on the project name in solution explorer –> Select Add –> New Item.

In the window that opens, select “Windows Phone Portrait Page”, name the page as “SecondPage.xaml” and click on Add.

Read the rest of this entry »

Written by Mako

April 6th, 2014 at 2:24 pm

Getting Started With Windows Phone Development

with 2 comments

I started developing application for the Windows Phone platform a few months ago. There are a lot of things i learned along the way and i want to share all that with you through a series of blog posts. In the current post, we will focus on the basic and will develop a very simple app for the Windows Phone platform.

Getting The Development Tools

To develop applications for Windows Phone 8, you will need to download and install the Windows Phone 8 SDK. You can get the sdk by going to and clicking on “Download Dev Tools” which will take you to the page from where you can download the Windows Phone 8 SDK. Please be aware of the minimum system requirements that is needed. You will need Windows 8 64 bit or Windows 8 pro 64 bit version or higher if you want to use the Windows Phone 8 Emulator. You will also need Visual Studio 2012/2013 installed. If you don’t have VS 2012/2013 on your machine, the setup will install the Visual Studio 2012 Express for Windows Phone. For running Windows Phone Emulator, you will need Windows 8 pro or higher and a processor that supports SLAT. If your system doesn’t meet the requirement for Emulator, you can still develop applications using the SDK but you will need a Windows Phone 8 device to test your app. Read the rest of this entry »

Written by Mako

March 31st, 2014 at 7:18 am

Windows Phone 8.1 Hands On

without comments

Microsoft recently released Windows Phone 8.1 as a developer preview for Developer Unlocked phones. Anyone having a developer unlocked phone can install the OS update and get to try out the new features. I installed it on my Lumia 520 and here are some of the new features which are worth mentioning.

New Features

Cortana (Personal Assistant)

‘Cortana’ is a digital personal assistant and Microsoft’s version of Apple’s Siri and Google Now. Currently it is only available to US region only but even if you are from a different region you can try it out by changing your phone’s Location setting to US. This is one of the biggest new feature introduced and it is here to make your life easier. Instead of searching for anything, you can ask Cortana to do it for you. It can be voice activated or you can simply type in the questions that you want to ask. You can ask things like “Set a reminder for gym at 5 am”, “Play Wake Me Up by Greenday”, “Find bars near my place” etc. Currently as it for US region only, the location based search won’t work well if you are in some other regions but for other things, it worked great.

Read the rest of this entry »

Written by Mako

February 20th, 2014 at 6:49 pm