You Are Here:

Community: Wiki

This page was last modified 09:23, 11 June 2009.

PushRegistry

From Forum Nokia Wiki


The push registry enables MIDlets to set themselves up to be launched automatically, by setting an alarm or by sending . The push registry manages network- and timer-initiated MIDlet activation; that is, it enables an inbound network connection or a timer-based alarm to wake a MIDlet up. For example, you can write a workgroup application that employs network activation to wake up and process newly received email, or new appointments that have been scheduled. Or you can use timer-based activation to schedule your MIDlet to synchronize with a server every so often then go to sleep.

This is a general property of MIDP2.0 specification.But different vendors have implemented it differently. For eg; in Nokia & Sonyericsson phones there a permission message is displayed whether you want to activate the push registered application. Where as in Siemens phones only a star sign will be displayed.


Contents

The PushRegistry class exposes the following methods:

  • getFilter(), to return the <AllowedSender> value for the connection (this can be

a server IP address, a comma-delimited list of IP addresses, or an “*” to allow any connection).

  • getMidlet(), to return the MIDlet name registered for the specified connection.
  • listConnections(), to return a list of push connections registered for the specified

MIDlet suite.

  • registerAlarm(), to register a timer-based trigger to launch the MIDlet, or to

disable an existing alarm for the MIDlet if the argument supplied is zero.

  • registerConnection(), which registers a connection for the MIDlet.
  • unregisterConnection(), which likewise unregisters a connection.


Exceptions

The following exceptions should be caught:

  • ClassNotFoundException
  • ConnectionNotFoundException
  • IllegalArgumentException
  • IOException
  • SecurityException


Using SMS Connections

It is useful to note that a MIDlet can initiate a socket or HTTP connection after it has been awakened by an incoming message, if further exchange of data is required.

The port specified can be from the full range 1 to 65535, however the following ports are reserved and must not be used:

  • 2805 WAP WTA secure connectionless session service
  • 2923 WAP WTA secure session service
  • 2948 WAP Push connectionless session service (client side)
  • 2949 WAP Push secure connectionless session service (client side)
  • 5502 Service Card Reader
  • 5503 Internet access configuration reader
  • 5508 Dynamic Menu Control Protocol
  • 5511 Message Access Protocol
  • 5512 Simple e-mail Notification
  • 9200 WAP connectionless session service
  • 9201 WAP session service
  • 9202 WAP secure connectionless session service
  • 9203 WAP secure session service
  • 9207 WAP vCal Secure
  • 49996 SyncML OTA configuration
  • 49999 WAP OTA configuration

Registration

Push Registry can handle requests to register connections in two ways:

  1. dynamically at run time,
  2. statically through entries in the JAD file

Dynamic Registration

Dynamic registration is a MIDlet notifying the AMS at run time that it wants to be activated by an incoming network connection or alarm event should the MIDlet be exited prior to that event occurring.

For a connection the registerConnection method is used:

registerConnection(String connection, String midlet, String
filter)

and

this.getClass().getName()

can be used to specify the current MIDlet.

Some of the examples for Dynamic Registration :

registerConnection(“sms://:” + portNumber);
registerConnection(“datagram://:” + portNumber);

Static Registration

If a connection’s sender and connection type are known when the MIDlet is installed, the registration request can be made at installation, and is therefore regarded as static. Static requests are defined in the JAD file using the Midlet-Push-<n> attribute:

MIDlet-Push-<n>: <ConnectionURL>, <MIDletClassName>,
<AllowedSender>

where n is a sequence number allowing more than one connection to be declared, ConnectionURL is the URL to monitor for an incoming connection, MIDletClassName is the MIDlet to start, and AllowedSender is the filter: a list of IP addresses or “*” for any.

An example for SMS connection :

MIDlet-Push-1: sms://:10000, TestMIDlet, *

Unregistering the connections

Dynamic registrations can be removed by using unregisterConnection specifying the connection only:

unregisterConnection(“sms://:10000”)

To determine if the MIDlet was invoked by an incoming message:

In startApp():

String connectsFound[];
connectsFound = PushRegistry.listConnections(true);

This returns the list of registered connections.

if connectsFound == null || connectsFound.length == 0)
{
~ started by user, code to exit or bypass push-related activity ~ 
}
else
~ started by inbound connection so code for push registry initiation ~ 
}


Sun Resourece: http://developers.sun.com/techtopics/mobility/midp/articles/pushreg/

java world resoure: http://www.javaworld.com/javaworld/jw-04-2006/jw-0417-push.html

Sonyericsson resource: http://developer.sonyericsson.com/site/global/techsupport/tipstrickscode/java/p_tips_java_1201.jsp

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditFurlTechnocratiMagnoliaTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fMMPE5ffileX qdcZpublisherQUxhttpE3aE2fE2fswE2enokiaE2ecomE2fidE2fc764fd1cE2d8b06E2d499aE2d9a6aE2d17c3903d5a65E2fforumE5fnokiaE5fcrawlerE5fagentX qdcZtitleQSxMMPE20fileE20E2dE20ForumE20NokiaE20WikiX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfnTypeZCommunityContentQ qdcZtypeQUqfnTypeZE52esourceQ qdcZtypeQUqfnTypeZWebpageQ qdcZtypeQUqfnTypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qrssZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qfnZdistributionQUxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2fX qfnZtypeQUqfnTypeZCommunityContentQ qfnZtypeQUqfnTypeZE52esourceQ qfnZtypeQUqfnTypeZWebpageQ qfnZtypeQUqfnTypeZWikiContentQ qfnZupdatedQDx2008E2d10E2d02X qfnZuserE5ftagQSxfileX qfnZuserE5ftagQSxlibpathX qfnZuserE5ftagQSxmmpX qfnZuserE5ftagQSxresourceX qmarsZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfnTypeZCommunityContentQ qrdfZtypeQUqfnTypeZE52esourceQ qrdfZtypeQUqfnTypeZWebpageQ qrdfZtypeQUqfnTypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ
User Rating: qfnZuserE5FratingQNx5E2E0000X
RDF Facets: qfnZuserE5FtagQSxhowE20toE20useE20pushregistryE2EX