Coding Paradox

Blog On .Net, CSharp, Windows Phone Programming

C# 6.0 New Features

without comments

C# 6 is available with Visual Studio 2015 and it comes with some new features. To try C# 6, download and install the Visual Studio 2015 preview.

Here are some of the new features that are available in C# 6

1) Auto Property Initializers

You can now assign the value to a property directly at the declaration place. With read only properties (getter only), you can assign the value at the declaration or in the constructor Read the rest of this entry »

Written by Mako

February 24th, 2015 at 4:46 am

Posted in C#,CodeProject

Using Camera in Android Application

without comments

In this post we will take a look at how to integrate camera with our android application. There are two ways in which we can use Camera in our Android application. Android provides you with 2 options while working with Camera

1) Use an existing Camera application

2) Work with Camera hardware API directly

If you are developing a full fledged camera application, then you need to work with the Camera API directly as it gives you more control but it involves a lot more coding. If you just want to integrate the camera with your app, the first option is better and simpler. In this tutorial, we will learn how to use an existing camera app with our application. We will create a simple application that will take pictures and display the same in a ListView. The application will display a Camera button, clicking which will open the existing camera app present on the device. Once the user takes a picture, he will be redirected back to our application and the picture that he has taken will be displayed in a listview and it will be saved to a permanent location. Read the rest of this entry »

Written by Mako

December 2nd, 2014 at 8:57 pm

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 OpenWeatherMap.org. 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

Introduction to Swift

without comments

Swift is a brand new programming language which was revealed by Apple at WWDC 2014 along with iOS 8. It is set to eventually replace the Objective – C language which is currently being used for Apple development. Swift is easier to learn and it has got a much cleaner syntax as compared to Objective – C. The syntax of Objective – C was very different compared to what you may be used to if you have previous experience with Java, C#, Javascript etc. With Swift, the syntax will seem a bit similar if you have previous web development experience.

Swift is designed to work alongside Objective – C programs. You can add swift code to your existing applications and it will work fine with the existing Objective – C code. If you are new to iOS development, then you can easily start learning Swift although some knowledge of Objective – C may also be helpful as there are a lot of existing libraries which are already written in Objective – C. But Swift is definitely the language for the future and it will slowly replace Objective – C. Along with the language, Apple also released a Swift programming guide which gives a detailed walk through of the language. In this post, i will briefly give an introduction to basic Swift syntax. Read the rest of this entry »

Written by Mako

August 6th, 2014 at 9:05 am

Posted in CodeProject,iOS,Swift

Tagged with , , ,

Getting Started With Android Development

with one comment

Introduction

In this article, we will be creating a simple “Hello World” Android application. We will use the default template that Eclipse provides while creating a new android app and we will also examine the files that are created. I will give a brief overview of each step and you will get a fair idea on how you can start developing applications. To develop applications for Android, you will require the Android SDK along with the platform tools and a development environment. In this tutorial, i will be creating the application using the Eclipse IDE. To download the tools and configure your development environment, visit the Android Developer site and download the ADT bundle. Once you have all the tools installed, you are ready to proceed further. You will also need to have a basic knowledge of Java and have the latest Java SDK installed on your machine.

Read the rest of this entry »

Written by Mako

August 3rd, 2014 at 8:28 am

Getting Started with AngularJS

without comments

One of the cool things i recently started learning was AngularJS. It is a JavaScript framework for building client side JavaScript applications which follows the Model-View-Controller pattern and ensures that your application is property architectured, easy to maintain and test. Some of the great features that it offers include two way data binding, client side templates, directives, routing, promises, dependency injection etc. All these features helps to reduce the complexity of the web application. If you have previous experience using Jquery, you will immediately notice how you can manipulate the DOM easily without writing any JavaScript code.

Read the rest of this entry »

Written by Mako

July 7th, 2014 at 7:33 pm

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

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

April 20th, 2014 at 6:49 pm