×
Namespaces

Variants
Actions
(Difference between revisions)

Calculating Azan Time by S60 Widgets

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Bot fixing redirect link)
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update - Add ArticleMetadata)
 
Line 1: Line 1:
 +
{{ArticleMetaData <!-- v1.2 -->
 +
|sourcecode= [[Media:AzanWidget.zip]]
 +
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 +
|devices= <!-- Devices tested against - e.g. ''devices=Nokia 6131 NFC, Nokia C7-00'') -->
 +
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Qt SDK 1.1.4]) -->
 +
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
 +
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 +
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 +
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 +
|keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase -->
 +
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 +
|translated-by= <!-- [[User:XXXX]] -->
 +
|translated-from-title= <!-- Title only -->
 +
|translated-from-id= <!-- Id of translated revision -->
 +
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20090630
 +
|author= [[User:Mahbub s60]]
 +
}}
 
[[Category:Location]][[Category:Symbian Web Runtime]]
 
[[Category:Location]][[Category:Symbian Web Runtime]]
 
== Introduction ==
 
== Introduction ==
Line 56: Line 78:
 
This example has been tested with Nokia 5800. Implementation can be found from following link:
 
This example has been tested with Nokia 5800. Implementation can be found from following link:
  
[[Image:AzanWidget.zip]]
+
[[File:AzanWidget.zip]]
[[Category:Code_Examples]]
+
[[Category:Code Examples]]

Latest revision as of 09:16, 19 July 2012

Article Metadata
Code ExampleArticle
Created: mahbub_s60 (30 Jun 2009)
Last edited: hamishwillee (19 Jul 2012)

Contents

[edit] Introduction

Muslims are supposed to perform five prayers every day. Each prayer is given a certain prescribed time in which it must be performed. To determine the exact time period for each prayer, we need to determine several points of time per a day. To determine the prayer times we must know the location (to know sunrise and sunset of the day). This article describes how we can use location information by using Location service API to calculate the prayer times. Following code shows how we can calculate Longitude and Latitude by using Location API.

[edit] Pre condition

This will only work on S60 5th Edition devices, like Nokia 5800. This will not work on a Nokia N95, for example, which is a S60 3rd Edition FP1 device.

[edit] Location Calculation

Locationcalculate returns the longitude and latitude of the device location.

function Locationcalculate()
{
 
var serviceObj = null;
 
// Initializes the widget
 
// Obtain the Location service object
try {
serviceObj = device.getServiceObject("Service.Location", "ILocation");
} catch (ex) {
alert("Service object cannot be found.");
return;
}
 
// We are interested in basic location information (longitude, latitude
// and altitude) only, so let's define the criteria respectively
var criteria = new Object();
criteria.LocationInformationClass = "BasicLocationInformation";
 
// Obtain the location information (synchronous)
var result = serviceObj.ILocation.GetLocation(criteria);
var latitude = result.ReturnValue.Latitude;
var longitude = result.ReturnValue.Longitude;
return [latitude, longitude];
}

[edit] Prayer Time Calculation

This link provides the actual calculation formula as java script that has been reused here. Obtained latitude and longitude are passed to the calculation module in the following way.

	var date = new Date(); // today
 
// Send latitude, longitude and time zone. Time zone is based on 15 dg apart with longitude
var zone = Math.ceil(result[1]/15.0)+1;
AzanTimes = prayTime.getPrayerTimes(date, result[0], result[1], zone);

[edit] Example Applications

Complete Azan application can be downloaded for free from [1]. This version is unsigned, it needs to be Symbian signed.
This example has been tested with Nokia 5800. Implementation can be found from following link:

File:AzanWidget.zip

This page was last modified on 19 July 2012, at 09:16.
74 page views in the last 30 days.
×