Showing posts with label Mango. Show all posts
Showing posts with label Mango. Show all posts

October 27, 2011

Diwali Gift: Sanskrit Shlokas – My Windows Phone App

 

SplashScreenImage

Behind this application, I had two motives.

  1. Sanskrit is very old language. This language has priceless collection of Subhashitas & Shlokas, which indeed has a great meaning. Unfortunately in the current era of English as a business language and various languages spoken at different states in India, hard to learn Sanskrit is missing its place. This app is just an attempt to share the great content in this language and keep it alive. This is just a first version, with few Shlokas. However, I’ve already started working on update to this application, which will have more content and more features. There may be some mistakes in the content or the meaning provided in this application. In this case, do write to me on my mail id mayur.tendulkar {at} hotmail.com and I’ll be glad to rectify those errors.
  2. I wanted to understand the gotchas in Windows Phone 7 app development and the MarketPlace submission process. And I’m happy that I had a nice experience with this application submission and testing process. Pretty well.

During this application development, I surfed internet for Sanskrit content and I landed up on www.samskrutam.com, which has a great collection of Sanskrit literature. I ‘m really thankful for their content.

I hope, you’ll like this application. Do let me know your feedback on this (positive or negative).

Namaste

Mayur Tendulkar | www.mayurtendulkar.com

August 4, 2011

Multitasking in Windows Phone 7 [Mango] - Part II

In my previous post, I talked about different ways [or options] to build applications which can do multitasking on Windows Phone [Mango] devices. In this post, we’ll do hands-on on one of the option – PeriodicTask

From MSDN: PeriodicTask inherits from the base classes ScheduledTask and ScheduledAction. It allows applications to perform processing even when the main application is not in the foreground. This class is used for tasks that need to run regularly for a small amount of time and are allowed a very limited amount of device resources.

To create application which will run in background, you’ll need to “host” it via another application of type “Background Agent”. And this involves three steps:

Step 01: Create a normal Windows Phone 7.1 [Mango] Application

In this step, you create a normal WP application, which you want to run in the background. However, keep in mind that few APIs will be unavailable while running your app in the background. More information here Unsupported APIs for Scheduled Tasks for Windows Phone 

Step 02: Create Windows Phone Scheduled Task Agent

Create a new project of type Windows Phone Scheduled Task Agent. It will give you OnInvoke method, which will run the scheduled task and do additional job, which you want to run in the background.

Step 03: Modifications in main application:

In your main application [which you created in Step 01] add reference to this Windows Phone Scheduled Task Agent application, and notice the WMAppManifest file in Properties tab. It’ll have following information embedded:

image

Now, add a button [button1] to main page and add following code your main application:

image

Here, you’re creating an object of PeriodicTask and passing agent application as parameter from main application.

That’s it. Now run your application, click on a button to start the background service. On Phone, go to settings > Applications > Background Tasks and there you should be able to see your application running in background:

image

Now, you can run your application again and see how it’s behaving.

Namaste

Happy Coding

Mayur Tendulkar | www.mayurtendulkar.com

July 11, 2011

Multitasking in Windows Phone 7 [Mango]

Multitasking on Windows Phone and multitasking on PC are totally different things. When it comes to multitasking on PC, developers/end-users have luxury of humungous amount of processing power and memory. Where as on mobile device, there are restrictions. Firstly, Windows Phone 7 doesn’t support multitasking. Which means third-party applications [i.e. applications developed by you and I] will not run in background. If end-user doesn’t see any app UI on his device, then that application is not running. Period. The only applications which may run in background were developed by Microsoft, which are kind of  ‘first party’ applications e.g. Zune media player, built-in Alarm and Reminders application. Which means, as of now, developers can’t write full blown media-players, location based services, alarm or reminder applications. Because they will be of no use if they are not running in background.

Having said that, Microsoft has introduced Multitasking functionality in coming release of Windows Phone, codenamed “Mango”. There is a complete namespace and few more new classes, which will support executing code [or let’s call it task] in the background. Note: Don’t confuse the term task with tasks in Microsoft.Phone.Tasks or Microsoft.Phone.TaskModel. Tasks in Microsoft.Phone.Task namespace will not take part in multitasking. There is separate namespace Microsoft.Phone.Scheduler which has classes allowing to build multitasking apps.

Broadly speaking, multitasking in Windows Phone is possible using classes given in Microsoft.Phone.Scheduler and those classes enable developers with functionalities like:

  • Scheduled Notifications:
    • Alarm : Used to create alarms.
    • Reminders : Used to create reminders.
  • Scheduled Tasks
    • Periodic Tasks : Used to create tasks with short life, which will execute after some defined interval and which will not be resource intensive. e.g. updating user location or caching small amount of data
    • Resource Intensive Tasks : Used to perform tasks running for long duration and consume lot of resources.
  • Background Transfer Service: Used to create applications, which can transfer data in the background. Consider, creating a download manager kind of application using this service.
  • Background Audio : In WP7, when media player application was created, if user moves to another application, the media player will stop playing that song. However in Mango, using this functionality, third-party media players will work like a charm. Along with it, IE9 on Mango has built in support for HTML5 with <Audio/> tag. Which will run media files in background inside browser. Amazing.

In next few posts, I’ll explain how you can do multitasking with this namespace. But before that, one quick question. How can you quickly navigate from one app to another which are taking part in multitasking? Simple, just press and hold back button for near about >2 seconds and it will bring a UI showing all the apps running in background and then you can switch the apps.

WP_000025

Namaste

Happy Coding

Mayur Tendulkar | www.mayurtendulkar.com