Deploying to Windows Devices

Introduction

Use Appcelerator Studio or CLI to deploy your Titanium projects as Windows Phone applications, which can be deployed to Windows Phone devices.  To deploy to a Windows tablet, you need to package a Windows Store app with Studio or the CLI, configure the tablet to sideload a package, and install the public certificate and package.

Windows Phone

Before deploying the application to a Windows Phone device, you will need to:

  • Set the Publisher ID in the CLI or Studio
  • Register the device using the Windows Phone Developer Registration tool (part of the Windows Phone SDK)
  • Connect the device to your computer with a USB cable
Icon

Currently, only one Windows Phone device may be plugged in to your computer to deploy. If multiple devices are plugged in, the build process will fail with an error.

Set the Publisher ID

To deploy to the Windows Phone emulator or device, and to create a Windows Phone store package, you need to set your publisher ID.

To retrieve your publisher GUID:

  1. Log into https://dev.windows.com.
  2. Click Dashboard in the top-right corner.
  3. Click Account settings in the left navigation.

The publisher GUID will be under the Account Details section as the Windows publisher ID field.

You can set the publisher ID using either the CLI or in the Studio Preferences dialog.  If you set the publisher ID using the CLI, the value will be passed to Studio from the CLI.

CLI Instructions

Use the appc ti config CLI command to set the windows.publisherId Titanium CLI key.

appc ti config windows.publisherId "CN=00000000-0000-1000-8000-000000000000"

Alternatively, you may also pass the publisher ID to the CLI using the -I option.

Studio instructions

  1. Open the Preferences dialog:
    1. On Mac OS X, from the menu bar, select Appcelerator Studio > Preferences.
    2. On Windows, from the menu bar, select Window > Preferences.
  2. In the Preferences dialog, navigate to Studio > Platforms > Windows.
  3. Enter your publisher ID in the Publisher Id field.

Register the Device

The following instructions are from Windows Dev Center: How to register your phone for development for Windows Phone 8.

 

  1. Turn on your phone and unlock the phone screen.

  2. On your phone, ensure that the date and time are correct.

  3. Connect your phone to your computer by using the USB cable that came with your phone.

  4. On your computer’s Start screen, switch to All apps view.

  5. Under Windows Phone SDK 8.1, click Windows Phone Developer Registration.

  6. Verify that the Status message displays Identified Windows Phone 8 device. Click the Register button to unlock the phone. If your phone is already registered, the Status message indicates this and you see an Unregister button.

  7. Click Register.

  8. In the Sign In dialog box for your Microsoft account (formerly known as a Windows Live ID), enter the email address and password for your Microsoft account. Click Sign In. If you’re a registered developer, be sure to use the Microsoft account associated with your developer account.

  9. After your phone is successfully registered, the Status message displays: "Congratulations! You have successfully unlocked your Windows Phone."

Your phone is now registered. You can now deploy apps to the phone.

Deploy to a Device with Studio

To deploy with Studio:

  1. Select the project in the Project Explorer view.
  2. In the global tool bar, select Run from the Launch Mode drop-down list.
  3. Select Windows Phone Device from the Target drop-down list.
  4. If the Launch Automatically option is enabled under the Target drop-down list, the application will be automatically launched after the device is selected.  If not, you need to click the Launch button to start the build process.

Your app will be built, installed to your device and automatically launched.

Deploy to a Device with the CLI

To deploy an application to a device with the CLI, run the following command:

appc run -p windows -T wp-device

Windows Tablet

To deploy to a Windows tablet, you need to sideload the application package to the device.

  1. Package the application as a Windows Store app. For instructions, see Distributing Windows Applications.
  2. Enable the Allow all trusted apps to install group policy
  3. Install the public certificate that was used to sign the package to the tablet's Trusted Root Certification Authorities store
  4. Execute a PowerShell command to install the package to the tablet with the Add-AppxPackage command.

After you package the application, copy the project's generated.cer and ./dist/<PACKAGE_NAME>_Win32.appx files to to a USB drive and plug it into the tablet.

Edit Group Policy Settings

To enable installation of the package, you need to update the device's group policy.

  1. Go to the Start screen and type "edit group policy."
  2. Click Edit Group Policy.
  3. Expand Computer Configuration \ Administrative Templates \ Windows Components 
  4. Click App Package Deployment.
  5. Double-click Allow all trusted apps to install.
  6. Click Enabled.
  7. Click OK.

Install the Certificate

Install the certificate you copied to the USB drive to the device's Trusted Root Certification Authorities store. You will need administrative privileges. 

  1. Double-click the certificate file.
  2. Click Install Certificate... to open the Certificate Import wizard.
  3. Click LOCAL MACHINE, then click Next.
  4. Click Place all certificates in the following store, click Browse, click Trusted Root Certification Authorities, click OK, then click Next.
  5. Click Finish.

A dialog should appear that the certificate was installed successfully.

Install the Package

Open PowerShell and execute the Add-AppxPackage command to install the application.

  1. Go to the Start screen and type "powershell."
  2. Click PowerShell.
  3. Execute the following command to install the package: 

    import-module appx
    add-appxpackage <PACKAGE_NAME>_Win32.appx

The application will be installed to the device and you can access it from the All apps screen.

 

 

Related Links