Friday, May 23, 2014

Developing native Apps for Jailbreaked Windows Phone

Windows Phone loaded with Windows OS like Windows Phone 7, Windows Phone 7.5, Windows Phone 7.8, Windows Phone 8 and lately if news sources are to be believed then even Windows Phone 8.1 is also on cards.


One thing for which Microsoft should be appreciated is the security & stability of the OS of Mobile Phone, When compared with Android it is much much secure OS and is on par with Apple iOS in terms of Security.
But adding security had imposed lot of restrictions and thus you wont find much applications as compared to Android & iPhone on Windows Store.


You will never find applications like Task Manger where you have flexibility to see which applications are running on phone, what amount of memory are they using which you can easily do it in even the cheapest of android phones. So here is the idea by which developers can develop applications which would have not been possible with Microsoft's restriction.


So as to develop a native application thus utilizing the core features which are currently available to OEMs, you need to jailbreak your windows phone.

Now what is Jail-breaking? Just visit here to find out what exactly Jailbreaking is and how to Jailbreak your Windows Phone. Once you have your phone jailbreaked, follow the below procedure to develop native application and enrich you applications with native functionality.

      1.    Download the DLL Import Project from the below link
     http://forum.xda-developers.com/showthread.php?t=1006331

    2.    The DLL Import Project contains compiled DLLs, with which you can access to those API which are not provided or accessible in non-jailbreak windows Phone 7

The following steps were followed while creating a new application taking reference of DLL Import project for CPU and Memory Analysis Tool:


       - Follow the normal procedure of creating a new Windows Phone 8/7.1 project on Visual Studio 2012.

       - When the project has been made, go to the Solution Explorer bar and right click on the project name.


       - Since the DLLs contains Native Code, Visual Studio will not allow you to add the DLL via Add references, so instead we have a workaround as follow


       -  Go to Add > Existing Item.


     - Doing this, navigate to the folder containing the respective DLLs you need to add for the project.


      - In that folder, select the respective DLLs and click open. The DLLs will be added.


     - For the Memory CPU Tool, the DLLs added were

                           DllImportMango.dll
                           Microsoft.Phone.InteropServices.dll
                           Microsoft.Live.dll
                           Microsoft.Phone.Controls.Toolkit.dll
                           Microsoft.Live.Controls.dll
                           AmCharts.Windows.QuickCharts.WP.dll.

     - After adding all the DLLs the main step is to set their properties.


    - Right click on each DLL name and go to Properties.


   - In properties the Build Action should be set to Content and Copy to Output Directory should be set to Copy Always.


    - This step should be done for all the DLLs.


    - Now go to the Solution Explorer and expand Properties.


    - Right click on WMAppManifest.xml and go to Properties.


   - Here also the Build Action should be set to Content and Copy to Output Directory should be set to Copy Always.


   - Now open the project in the file explorer and go to the folder named Properties.


   - In this folder edit the WMAppManifest.xml in the notepad. It should contain the following capabilities:

ID_CAP_GAMERSERVICES
ID_CAP_IDENTITY_DEVICE
ID_CAP_IDENTITY_USER
ID_CAP_LOCATION
ID_CAP_MEDIALIB
ID_CAP_MICROPHONE
ID_CAP_NETWORKING
ID_CAP_PHONEDIALER
ID_CAP_PUSH_NOTIFICATION
ID_CAP_SENSORS
ID_CAP_WEBBROWSERCOMPONENT
ID_CAP_NETWORKING_ADMIN
ID_CAP_INTEROPSERVICES
ID_CAP_RINGTONE_ADD
      - Now go to the solution explorer and right click on References and click on Add Reference.

      - Check mark the respective references required for the project.

      - In this project, the references used were:

Microsoft.Devices.Sensors
Microsoft.Phone
Microsoft.Phone.Interop
Microsoft.Xna.Framework
Microsoft.Xna.Framework.Game
mscorlib
mscorlib.Extensions
System
System.Core
System.Net
System.Windows
System.Xml
System.Xml.Linq


Above mentioned are all the points which should be kept in mind while creating a new application based on DLL Imports in Windows Phone 8/7.1



This is the procedure to use already available DLLs and access those APIS which DLL Import project has exposed.



In case you want to use/add/modify the APIs and create your new DLL. It is possible by following procedure.



1.      Install the following software

a.      Visual Studio 2008 SP1

b.      Windows Mobile SDK 6 PRO



2.      Now open the Solution which is there inside VS2008 folder of CSharp DLL Import Project which you have downloaded earlier.



3.      Once you open the solution you can easily modify/add the APIs which are available in Windows Mobile 6, compile the solution and get the respective DLL.



4.      Now you can use the newly made DLL by Add Existing Item and following the above procedure in you windows phone 7 projects which will run properly on Jailbreak Windows Phone 7.