Saturday, May 31, 2008

Mobile Development Code samples

  1. Andorid QR code samples
  2. Blackberry JDE code samples
  3. Android streaming mp3 code samples
  4. User Agent profile lookup


The Pirate BAY WAP RSS READER
File - rss.jsp
File - rss_detail.jsp
File - rssutils.tld
File - rssutils.jar

Working Sample




Microsoft MAPS asp.net c# code example

Click here



Google Spreadsheet as data source asp.net

using Google.GData.Client;
using Google.GData.Extensions;
using Google.GData.Spreadsheets;
using System.Globalization;

public partial class redeem : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void OnCode_Change(object sender, EventArgs e)
{
string visit = "0";
CultureInfo culture = new CultureInfo("en-US");
if (txtcode.Text.Contains("<")) { lblerror.Text = "Invalid Scan. Please try again"; lblerror.Visible = true; txtcode.Text = ""; } else { SpreadsheetsService service = new SpreadsheetsService("Sample Spreadsheet"); service.setUserCredentials("gmailuserid", "password"); SpreadsheetQuery query = new SpreadsheetQuery(); query.Title = "title of spreadsheet"; SpreadsheetFeed feed = service.Query(query); if (feed.Entries.Count != 1) return; AtomLink link = feed.Entries[0].Links.FindService(GDataSpreadsheetsNameTable.WorksheetRel, null); WorksheetQuery worksheetQuery = new WorksheetQuery(link.HRef.ToString()); worksheetQuery.Title = "Sheet1"; WorksheetFeed worksheetFeed = service.Query(worksheetQuery); if (worksheetFeed.Entries.Count != 1) return; WorksheetEntry worksheet = (WorksheetEntry)worksheetFeed.Entries[0]; AtomLink listFeedLink = worksheet.Links.FindService(GDataSpreadsheetsNameTable.ListRel, null); ListQuery listQuery = new ListQuery(listFeedLink.HRef.ToString()); ListFeed listFeed = service.Query(listQuery); foreach (ListEntry worksheetRow in listFeed.Entries) { string scanData = worksheetRow.Elements[0].Value.ToString(); string[] arSD = new string[100]; char[] splitterFilemSD = { ',' }; arSD = scanData.Split(splitterFilemSD); if (arSD.Length > 0)
{
string codess = arSD[0].ToString();
if (codess == txtcode.Text.ToString())
{
string ddtt = arSD[1].ToString();
string[] arUAm = new string[30];

char[] splitterFilem = { ' ' };
arUAm = ddtt.Split(splitterFilem);

if (arUAm.Length > 0)
{


ddtt = arUAm[1].ToString() + " " + arUAm[0].ToString()+".000";
}



DataAccess.InsertRedeem(txtcode.Text, arSD[2].ToString(), ddtt);
}
}


}
lblerror.Visible = false;

Session["WC"] = txtcode.Text.ToString();
DataTable dtCnt = DataAccess.GetStationCount(txtcode.Text);
if (dtCnt.Rows.Count > 0)
{
visit = dtCnt.Rows.Count.ToString();
}
DataAccess.InsertRedeem(txtcode.Text, "Redemption", DateTime.Now.ToString());
Response.Redirect("passfail.aspx?vs="+visit);
}
}
}



Google Gadget to send FREE SMS (I built it )

Download here





WAP Icon Launcher Blackberry Java Code-

launcher.java

import net.rim.device.api.system.ApplicationDescriptor;
import net.rim.device.api.system.ApplicationManager;
import net.rim.device.api.system.ApplicationManagerException;
import net.rim.device.api.system.CodeModuleManager;
import net.rim.device.api.ui.UiApplication;

public class launcher extends UiApplication {
public static void main(String[] args){
launcher instance = new launcher();
instance.enterEventDispatcher();
}

public launcher() {
boolean retval = true;
int handle = CodeModuleManager.getModuleHandle("net_rim_bb_browser_daemon");
if (handle <=0 ){ System.exit(0); }else{ ApplicationDescriptor[] browserDescriptors = CodeModuleManager.getApplicationDescriptors(handle);
if (browserDescriptors == null ){
System.exit(0);
}else{
if ( browserDescriptors.length <=0 ){ System.exit(0); }else{ String[] args = {"url", "http://wap.url.com"};
ApplicationDescriptor descriptor = new
ApplicationDescriptor(browserDescriptors[0],"url invocation",
args,null, -1, null, -1,ApplicationDescriptor.FLAG_SYSTEM);
try{
ApplicationManager.getApplicationManager().runApplication(descriptor);
}catch(ApplicationManagerException e){
System.exit(0);
}
System.exit(0);
}
}
}
}
}

Working Sample


WA
P Support Blackberry Verizon 8830 -

In trouble shooting WAP CSS style sheet not rendering for a Blackberry 8830 world phone 2 conclusions were reached .

1. By default this phone ships with style sheets turned off (you can instruct the user to enable them) .

2. you need to embed the style in the tag ex. NOT TO USE table class="class name here" YOU SHOULD USE table style="style definition here".












Android QR Code Screen Shots/Code Sample-


Click here




WURFL Tomcat working



WAP Definition -

Take for example the mobile device Blackberry 8300 (curve) User Agent of blackberry8300_ver1 . In the UA Profile of the user agent the XHTML level support is xhtml_support_level 3 as you can see below would support a nice looking WAP site.

Capability Name Type Description
xhtml_support_level[-1 |..| 4]Assuming the device supports some form of XHTML, this capability measures how reliably certain common designer features are supported, according to the following description:
- level "-1":
no XHTML support of any kind.
Possible WML support
Nokia 7110, 7210 as well as
all UP.Browser 4 and 5 devices.

- level "0" :
basic XHTML Support.
Minimum screen-width: 100 pixel
No (or very unreliable) CSS support.
Poor table support or none at all.
Basic forms: text field, select-option,
submit button.
May not be able to support input
mask on fields.
Ex Device: SonyEricsson T610/T616

- level "1" :
XHTML with some CSS support.
Minimum sceen-width: 120 pixels.
Hyperlinks may not be collorable by CSS.
Basic table support: 2x2 or more.
Colspan and rowspan may not be supported.
"width" expressed as percentage may be
unreliable.
Ex Device: Sharp GX 10, Nokia 3650

- level "2" :
Assume same capabilities as
level "1", but may vary in the future.
Ex Device: Nokia6600,Nokia5300

- level "3" :
Excellent CSS support.
Padding, border and margin are correctly
applied.
Can reliable apply colors to links,
text and background.
CSS graphic effects are pixel perfect
Minimum sceen-width: 164 pixels.
Can support complex tables (but not
necessarily nested tables) up to
4 cells in a row.
Not setting "font-size" produces
a readable font.
Supports background images also
when applied through CSS.
Generally running on 3G devices.
Ex: Nokia Series 60 DP 3,
Browsers: Openwave Mobile Browser 7,
MS Mobile Explorer,
recent BlackBerrys. Netfront 3.2,
Safari (including iPhone), Sony PSP...
(assuming high-bandwidth, Edge/UMTS/...)

- level "4" :
Level 3 + Ajax support.
Toggle display property.
XMLHTTPRequest(). InnerHTML()

No comments: