J2i.Net

Nothing at all and Everything in general.

Displaying Caller ID information on the Desktop

Caller ID Notification

I've been working on a program to mute my computer whenever the phone became active. After completing it I decided to add one more feature; caller ID.  Now when my mobile phone rings my computers (there are three in my work room) all mute and the caller ID information displays.  Upon termination of the call the computers that were not muted before the call are unmuted.  I've got to do some cleanup in the code but plan to have it posted on CodeProject.com in the next few days.

 

Windows Mobile Interoperability

I develop dektop applications, web applications, and mobile applications.  But many times a solution doesn't fit completly within the boundries of those three types of applications.  There are solutions in which a desktop front-end interacts with a web back-end, or a mobile device communicates with a desktop, or in which all three work together for a common purpose (an excellent example of such a solution is Exchange, Outlook, and Pocket Outlook).  Microsoft already provides solutions for making applications that interact with each other across process boundries, machine boundries, and even across different operating systems.

I've written a few articles on CodeProject.com that for the most part are isolated from other systems.  The projects and the example code are about Windows Mobile and run on Windows Mobile devices.  I am about to expand the types of solutions about which I write to solutions that cooperate with other devices (the other devices being servers, desktops, and potentially other Windows Mobile devices).  The articles aren't targetting webservices, WCF, or interprocess communication per se though those technologies may be used within the solutions.  Microsoft has alread done an excellent job of laying the ground work for Interoperability and thedeveloper only needs to use it.   These areticles are targetted at tacking the technologies that we already know to exists and demonstrating new ways of using them.

I know that doesn't give a clear idea of what these new articles will cover, but you won't need to wait long to find out.  I've already got the code for my next article written.  With a 4 day weekend quickly approaching I plan to use one of those days to complete the article for the code.  It will be for an application to make desktops and windows mobile devices cooperate in a new way.

Solution for Tilt Screen Flashing Problem

After I posted the page on Windows Mobile MEssage Queues I decided to use the Power Manager sample in it to diagnose a problem that I have had with my AT&T Tilt since the firmware update.  The problem was that after turning the device on many times it would immediatly turn back off.  Using the RequestPowerNotifications sample I was able to see what was going on with the power manager when this problem occured.  It appears the the device would go into a resuming state and then immediatly go back to the suspended state. Refering back to the article I published on Windows Mobile Power Management I remembered that if the device enters the resuming state and does not switch to another state then the device will suspend itself.  The time to change state is usually 15 seconds.  But OEMs have the option to change this time. Upon opening the registry path [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\Timeouts]  I found the keys [ACResumingFromSuspendTimeout] and [BatteryResumingFromSuspendTimeout] were both set to 1 second.  I set them to 5 seconds and I have not seen the problem since then.  So it would appear the problem was caused by the new power manager that on the device being unable to change the power state of the device fast enough.

Updating UI Elements from Other Threads

I often post on subjects that frequently become of relevance to post within the Smart Device MSDN forums. Today's item of interest is updating controls from worker threads.  ALl too often a developer new to programming on Windows devices will start a worker thread to perform a process then update a textbox, progress bar, or other control from the worker thread and wonder why it won't work.

To make a long story short you should never directly updte a UI element from a secondary thread.  A UI control is owned by the thread on which it was created.  No other thread can manipulate that control directly.  Instead request to update the control must be marshaled to the owning thread.  Controls within the .Net framework have a method named Incoke that will marshal method calls for you.

IE6 for Windows Mobile 6 Details

The Windows Mobile Team Blog has some details on IE6 for Windows Mobile 6.   Sadly it is confirmed that it is not available as a seperate download.  So if your device is nolonger getting firmware updates then you will only be bale to get it if you purchase a new device.  Some of the features are as follows:

  • Improved fidelity (support for full fidelity desktop rendering)
  • Layout fixes to accommodate a mobile screen (text wrap)
  • Enhanced Script and AJAX support  (Jscript v5.7 from Internet Explorer 8)
  • Improved multimedia experience (Adobe Flash Lite 3.1 for Adobe Flash content)
  • Deeper integration with search
  • Enhanced cursor navigation model
  • Touch and gesture support – pan support
  • Multiple zoom levels
  • Easy switching between mobile / desktop versions of sites by specifying UA strings.
  • If you want to do development with IE6 you don't need to wait.  An emulator for IE6 is available now.

    OpenCellID - open source cellular antenna based location

    By now many are either familiar with Skyhook Wureless or have seen a demonstration of the service they offer. They provide cell tower and network based location information for mobile phones and portable computers (the iPhone uses Skyhook for its data provider). I came across an alternative to Skyhook Wireless that is open source named OpenCellID (http://OpenCellID.org).  The concept is fairly simple, run the client on your phone and as you move from tower to tower your phone contributes to the database.  If you write an application that makes use of location services you can make use of OpenCellID to get location data if a GPS signal is not available.

    Unfortunatly the client for updating the database is JavaBased, so as much as I would like to I won't be running it.  But the service itself is web based so any application can make use of the data.

    Update [12/26/2008] - Update, looks that I will be using it.  Though it is not a proper service proxy I've managed to create something that allows me to interact with the service from within a .Net application.

    Detecting Storage Cards

    Some time ago in the MSDN forms I responded to a few questions on how to detect the storage cards in the file system and how does one get the storage card's capacity. I wrote the following could are a response to those questions and thought it would be helpful to share.  Storage cards show up in the file system as temporary directories.  This program examines the objects in the root of the device and any folders that have temp attribute are considered to be a positive match

    using System;
    using System.IO;
    using System.Runtime.InteropServices;

    namespace StorageCardInfo
    {
      class Program
      {
        const ulong Megabyte = 1048576;
        const ulong Gigabyte = 1073741824;

     

        [DllImport("CoreDLL")]
        static extern int GetDiskFreeSpaceEx(
           string DirectoryName,
           out ulong lpFreeBytesAvailableToCaller,
           out ulong lpTotalNumberOfBytes,
           out ulong lpTotalNumberOfFreeBytes 
        );

        static void Main(string[] args)
        {
          DirectoryInfo root = new DirectoryInfo(@"\");
          DirectoryInfo[] directoryList = root.GetDirectories();
          ulong FreeBytesAvailable;
          ulong TotalCapacity;
          ulong TotalFreeBytes;

          for (int i = 0; i < directoryList.Length; ++i)
          {
            if ((directoryList[i].Attributes & FileAttributes.Temporary) != 0)
            {
              GetDiskFreeSpaceEx(directoryList[i].FullName, out FreeBytesAvailable, out TotalCapacity, out TotalFreeBytes);
              Console.Out.WriteLine("Storage card name: {0}", directoryList[i].FullName);
              Console.Out.WriteLine("Available Bytes : {0}", FreeBytesAvailable);
              Console.Out.WriteLine("Total Capacity : {0}", TotalCapacity);
              Console.Out.WriteLine("Total Free Bytes : {0}", TotalFreeBytes);
            }
          }
        }
      }
    }

     

     

     

    24 Hours of Windows Mobile Review

    The 24 Hours of Windows Mobile webcast series is still underway.  If you've missed one of the presentations then you can catch the recorded version.  The links to the presentations are below. 

     

    Title Level Description
    Introduction to Windows Mobile Development 200 High level introduction to developing managed applications for mobile devices
    Interoperability Between Native and MAnaged Code 300 Basic's of P/Invoke and using COM objects
    Creating Adaptive Applications 300 Creating applications that work with a wide variety of formfactors
    Using Pocket Outlook Data within a Managed Application 300 Retrieving and manipulating data stored within Pocket Outlook
    Live Update from PDC 300 Sharing news announced at PDC time and other demonstrations
    Developing Battery Friendly Applications for Windows Mobile 300 Demonstration of the State and Notifications broker and other features of Windows Mobile that can assist in developing applications that consume less power
    Unit Testing for Mobile Devices 300 Explore using the unit testing functionality of Windows Mobile for devices