programming4us
programming4us
MOBILE

Programming the Mobile Web : Content Delivery (part 2) - File Delivery

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

2. File Delivery

To deliver a file, there are three models:

  • Direct linking

  • Delayed linking

  • OMA Download

You can use any of these three methods to deliver the files, either using the physical file (video, audio, game, etc.) directly or via a script (PHP, ASPX, etc.). If you use a script to deliver a file, you can log, secure, and even charge for every download. If the file is available directly through the web server, anyone with the URL can download the file.


Note:

The installation of files using HTTP is also called OTA (Over-the-Air) provisioning. Some low-end devices don’t have a web browser but do have the ability to download files (e.g., ringtones, applications, or images) using HTTP. We can offer files to those devices, but we must send the download URLs by WAP Push using SMS.


2.1. Direct linking

Direct linking is the simplest way to deliver content. A direct link is just a link to the file (with the right MIME type defined), a link to a script that will deliver the file, or a link to a script that will redirect the user to the file. For example:

<a href="game.jad">Download This Game</a>
<a href="download.php?id=22222">Download This Game</a>

The download.php script can save the download to the database, check permissions, and then deliver the content using the appropriate MIME type, writing the file to the response output or redirecting the browser to the file:

<?php
if ($everything_ok) {
header('Location: game.jad');
} else {
header('Location: download_error.php');
}

2.2. Delayed linking

Delayed linking is a technique often used in download sites for desktop browsers. It allows us to show a landing page before the download starts. This landing page will also be the document the user will see after the download has finished or, if the browser supports background downloading, while it is downloading.


Note:

Some devices also look for the type attribute in a link to decide how to manage the link before downloading the response from the server. For example, we can define a link as a Java ME JAD file using:

<a href="game.jad"
type="application/vnd.sun.j2me.app-descriptor"> Download This Game</a>


The technique involves linking to an XHTML document that will show the user some information and will use a refresh metatag to redirect the user to the direct link in X seconds (more than 5 for mobile devices).

So, the download page will redirect to:

<a href="download.html">Download This Game</a>

And download.html will contain code like the following:

<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
"http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="refresh" content="5;game.jad" />
<title>Download File</title>
</head>

<body>
<h1>Your game is being downloaded</h1>
<p>If the file is not downloaded in 5 seconds,
<a href="game.jad">click here</a>

<h2>Brought to you by "Your favourite ad here"</h2>

<p>Trouble downloading this game? <a href="sms:611">Send us an SMS</a>
<a href="tel:611">Call Us</a></p>

<a href="/">More Downloads</a>
</body>
</html>

2.3. OMA Download

OMA Download is a standard defined in 2004 by the Open Mobile Alliance to allow us more control over the delivery of media objects. It also has support for Digital Rights Management (DRM) in two versions, OMA DRM 1.0 and OMA DRM 2.0.


Note:

Many browsers support the download of Multimedia Messaging Services (MMS) templates using a format called the Synchronized Multimedia Integration LanguageNokia tools available at http://www.mobilexweb.com/go/mms. (SMIL). This is useful if you are offering templates like postcards. You can create messages using


OMA Download adds two phases to the download process: before download and after download.

The before download process involves a description file downloaded using HTTP before the real file is downloaded. This description file is an XML file containing metainformation for the operating system and instructions for doing the download. This process gives the user an opportunity to see information about the content (name, compatibility, size) before accepting it, as shown in Figure 1.


Note:

Using OMA DRM you can protect a file from being sent by MMS, Bluetooth, or any other method after it has been installed on the device. This is to avoid piracy of video, music, Flash Lite, and other multimedia content. Nokia, Sony Ericsson, and Motorola devices are known to have support for this standard.


The after download process involves an HTTP request posted to your web server from the operating system, confirming the final status of the download. This allows you to confirm that the file has been correctly downloaded and installed.

Figure 1. With OMA Download we can give the user more information about the content before she downloads it.


OMA DRM supports the ability to define the right to play, display, or execute a media object or a file a limited number of times. DRM should be managed with care, and you need to test compatibility with the devices you’re targeting before using it.


Note:

Sprint, a U.S. carrier, uses a similar format called General Content Descriptor (GCD). A GCD file is a text file with a .gcd extension that is very similar to the JAD file in Java ME.


2.3.1. Download descriptor

The descriptor is an XML-based file that should be served using the MIME type application/vnd.oma.dd+xml.

Here’s a simple example of this file:

<?xml version="1.0"?>
<media xmlns="http://www.openmobilealliance.org/xmlns/dd">
<name>The first man on the moon</type>
<type>video/mp4</type>
<objectURI>http://mobilexweb.com/video.mp4</objectURI>
<size>230</size>
<installNotifyURI>http://mobilexweb.com/download/notify.php?id=3333
</installNotifyURI>
</media>

These are the typical attributes: name, the user-readable name of the content file; type, the MIME type of the file; objectURI, the absolute URL of the file; size, the file size expressed in KB; and installNotifyURI, the URL that will receive the after-download status (this can have GET parameters defined dynamically to log whether or not the download was saved).

Additional properties are also available, like nextURL (the URL of a website to visit after the download has finished), description (a short description of the media file), vendor (the organization providing the file), and iconURI (an optional icon to be shown with the file information).


Note:

There are good resources and tools on the Forum Nokia, Sony Ericsson, and Adobe websites about OMA Digital Rights Management. You can find more information at http://www.mobilexweb.com/go/drm.


2.3.2. Post-download status report

If you define the installNotifyURI in the download descriptor, you will receive a POST request to that URL when the download finishes. This URL will receive as the POST body an integer code with a status message. The important thing is that this request does not come in the normal URL-encoded way, so you can’t use the typical $_FORM or Request.Form. To read the status code, you’ll need to read the request body in a low-level format. Table 1 lists the most common OMA Download status codes to read in our scripts.

Table 1. OMA Download status codes
CodeMessageDescription
900SuccessThe object was downloaded and installed.
901Insufficient MemoryThe device has no space to download or install the file.
902User CancelledThe user cancelled the download.
903Loss of ServiceThe device lost the network connection while downloading the file.
905Attribute MismatchThe file doesn’t match the download descriptor (e.g., the MIME type). The file will be rejected.
906Invalid DescriptorThe download descriptor is invalid.
951Invalid DDVersionThe download descriptor version is invalid.
952Device AbortedThe device aborted the installation process. This can occur for different reasons.
953Non-Acceptable ContentThe device cannot use the file.
954Loader ErrorThe URL of the file is not working.

To read the OMA Download response from a PHP script, you can use the following sample code:

<?php
// We get the post body from the input
$post = file_get_contents('php://input');
// We get the first three characters without spaces
$status = substr(trim($post), 0, 3);

if ($status==900) {
// Download OK, save information to the database
} else {
// Some error happens, save information to the database
// to allow the same user to download it again
}

?>

If you are delivering premium content that the user has paid for, if the download fails you should deliver the same content without forcing the user to pay again. Even if the download has succeeded, many carriers insist that the content be made available free of charge for 24 hours (or even up to a week). Some new application stores also allow the users to download the premium content again even if they change their mobile devices.


Note:

Remember that you can check for OMA Download compatibility using WURFL, DeviceAtlas, or another library before using this download mechanism.


Table 2 reports on browser compatibility with OMA Download.

Table 2. OMA Download compatibility table
Browser/platformOMA Download compatibility
SafariNo
Android browserNo
Symbian/S60Yes
Nokia Series 40Yes
webOSNo
BlackBerryDepends on the device
NetFrontYes
Openwave (Myriad)Yes
Internet ExplorerDepends on the device
Motorola Internet BrowserDepends on the device
Opera MobileNo
Opera MiniNo

Other  
  •  iPhone Application Development : Using Switches, Segmented Controls, and Web Views (part 3)
  •  iPhone Application Development : Using Switches, Segmented Controls, and Web Views (part 2)
  •  iPhone Application Development : Using Switches, Segmented Controls, and Web Views (part 1)
  •  iPhone Application Development : Using Advanced Interface Objects and Views - User Input and Output
  •  Windows Phone 7 Development : Wiring Up Events to an Application Bar ( part 2)
  •  Windows Phone 7 Development : Wiring Up Events to an Application Bar ( part 1) - Reacting to Add Button Events
  •  Adding an Application Bar to a Windows Phone 7 Application (part 3) - Adding an Application Bar Using Managed Code
  •  Adding an Application Bar to a Windows Phone 7 Application (part 2) - Adding a Local Application Bar Using XAML & Adding Menu Items
  •  Adding an Application Bar to a Windows Phone 7 Application (part 1) - Adding Images for Use with Application Bar Buttons & Adding a Global Application Bar Using XAML
  •  iPhone Application Development : Creating and Managing Image Animations and Sliders (part 3) - Finishing the Interface
  •  
    Top 10
    Free Mobile And Desktop Apps For Accessing Restricted Websites
    MASERATI QUATTROPORTE; DIESEL : Lure of Italian limos
    TOYOTA CAMRY 2; 2.5 : Camry now more comely
    KIA SORENTO 2.2CRDi : Fuel-sipping slugger
    How To Setup, Password Protect & Encrypt Wireless Internet Connection
    Emulate And Run iPad Apps On Windows, Mac OS X & Linux With iPadian
    Backup & Restore Game Progress From Any Game With SaveGameProgress
    Generate A Facebook Timeline Cover Using A Free App
    New App for Women ‘Remix’ Offers Fashion Advice & Style Tips
    SG50 Ferrari F12berlinetta : Prancing Horse for Lion City's 50th
    - Messages forwarded by Outlook rule go nowhere
    - Create and Deploy Windows 7 Image
    - How do I check to see if my exchange 2003 is an open relay? (not using a open relay tester tool online, but on the console)
    - Creating and using an unencrypted cookie in ASP.NET
    - Directories
    - Poor Performance on Sharepoint 2010 Server
    - SBS 2008 ~ The e-mail alias already exists...
    - Public to Private IP - DNS Changes
    - Send Email from Winform application
    - How to create a .mdb file from ms sql server database.......
    programming4us programming4us
    programming4us
     
     
    programming4us