majorto

tooogooo  时间:2021-02-05  阅读:()
CopyrightIBMCorporation2009TrademarksJ2MEPersonalInformationManagement(PIM)-AnOverviewPage1of7J2MEPersonalInformationManagement(PIM)-AnOverviewProvidingtheabilitytoaccessthenativepersonaldataonmobiledevicesSomaGhoshDecember07,2009ThePersonalInformationManagement(PIM)API,asdefinedbyJSR75,providesawaytoaccessthenativepersonaldataonthemobiledevices,beittheContacts,TasksorAppointments.
Inthisarticle,wewillhaveacloselookattheAPI,discussthedevelopment,securityanddeploymentconsiderationsofaPIMMIDletandcomparePIMwithanotherJ2MEAPI,theRecordManagementStore(RMS).
PersonalInformationManagement(PIM)inmobileenvironmentAsnewdevicesmaketothemarket,theavailabilityofAddressBook,CalendarandTasklistonmobiledevicesisabarenecessity.
TheJ2MEapplicationsalsofeeltheneedtohaveaccesstothesedata.
TheoptionalpackageJSR75PersonalInformationManagement(PIM)packageprovidesthiscapability.
Itnotonlyallowstheaccesstonativepersonalinformationwhichcomprisescontacts,appointmentsandtasks,alsotoinformationbasedonSIMcardsattachedtodevices,LocalandRemotePersonalInformationdatabases.
ThePIMpackagehascapabilitytoexportandimportofdatafromvCardandvCalendar,theInternetstandardformatsforAddressBookandCalendarrespectively.
Italsohasthesecurityfeaturestopreventunauthorizedclassesfromretrievingpersonalinformation.
Theotheroptionalpackage,JSR75FileConnectionprovidesawaytoaccessthenativefilesystemwhichisoutofscopeforourdiscussion.
TheJ2MEPIMpackageTheJavaPIMpackageisrepresentedbythejavax.
microedition.
pimpackage.
Thesignificantinterfacesdefinedbythispackageare:developerWorksibm.
com/developerWorks/J2MEPersonalInformationManagement(PIM)-AnOverviewPage2of71.
Contact–ThisInterfacerepresentsasinglecontactontheAddressBook.
2.
ContactList–ThisInterfacerepresentsAddressBookwhichisalistofContacts.
3.
Event–ThisInterfacerepresentsasingleCalendarEvent.
4.
EventList–ThisInterfacerepresentsalistofCalendarevents.
5.
ToDo–ThisInterfacerepresentsasingleTaskintheTaskList.
6.
ToDoList–ThisInterfacerepresentstheTasklist.
Themajorclassdefinedbythispackageis:PIM–ThePIMclassdefinesmethodsthatcancreateanindexofallexistingLists,openandeditthoselistsaswellasimportandexportfromInternetstandardformatsforContactandCalendar,thevCardandvCalendar.
ContactandContactListAContactrepresentsasingleentryintheAddressBook.
ThemajorfieldsinaContactareName,Address,Email,Birthday,PhotoandTelephone.
Inordertoensureportabilityacrossplatforms,itisadvisabletousethemethodisSupportedField()providedbySuperInterfacePIMList.
Listing1,belowshowshowaContactcanbeaddedtoAddressBook:Listing1.
AddContacttoAddressBookContactListaddressBook=null;try{addressBook=(ContactList)PIM.
getInstance().
openPIMList(PIM.
CONTACT_LIST,PIM.
READ_WRITE);}catch(PIMExceptione){//ExitApplication}ContactsingleContact=addressBook.
createContact();String[]name=newString[addressBook.
stringArraySize(Contact.
NAME)];if(addressBook.
isSupportedField(Contact.
NAME_FORMATTED)singleContact.
addString(Contact.
NAME_FORMATTED,PIMItem.
ATTR_NONE,"Mrs.
JaneDoe");ThecreateContact()methodcreatesatemporaryemptyContact.
Acommit()callmakestheContactdatapersistent.
Itisadvisabletoclosethelistsbyinvokingtheclose()methodafternecessaryoperationshavebeenperformed.
try{singleContact.
commit();}catch(PIMExceptione){//Exceptionoccured}try{//OthercleanuptasksaddressBook.
close();}catch(PIMExceptione){}ibm.
com/developerWorks/developerWorksJ2MEPersonalInformationManagement(PIM)-AnOverviewPage3of7EventandEventListAnEventrepresentsasingleentryintheEventdatabase,forexample;calendaronthemobiledevice.
ThecriticalfieldsareLocation,Summary,Startdate,EndDateandAlarmnotification.
Listing2showshowanEventcanbeaddedtotheEventdatabase.
Listing2.
AddanEventEventListeventList=null;try{eventList=(EventList)PIM.
getInstance().
openPIMList(PIM.
EVENT_LIST,PIM.
READ_WRITE);}catch(PIMExceptione){return;}EventsingleEvent=eventList.
createEvent();if(eventList.
isSupportedField(Event.
SUMMARY))singleEvent.
addString(Event.
SUMMARY,PIMItem.
ATTR_NONE,"JavaTraining");if(eventList.
isSupportedField(Event.
START))singleEvent.
addDate(Event.
START,PIMItem.
ATTR_NONE,aDate.
getTime());if(eventList.
isSupportedField(Event.
END))singleEvent.
addDate(Event.
END,PIMItem.
ATTR_NONE,aDate.
getTime());try{singleEvent.
commit();}catch(PIMExceptione){//Anerroroccured}try{eventList.
close();}catch(PIMExceptione){}ToDoandToDoListTheToDointerfacerepresentsasingletaskontheTaskdatabaseonthemobiledevice.
TheimportantfieldsareNoteorSummary,Priority,CompletionDate,DueDateandwhethercompleted.
Listing3showshowaToDocanbepersistentlyaddedtothedatabase.
Listing3.
AddaTaskToDoListtasks=null;try{tasks=(ToDoList)PIM.
getInstance().
openPIMList(PIM.
TODO_LIST,PIM.
READ_WRITE);}catch(PIMExceptione){//Anerroroccurredreturn;}ToDosingleTask=tasks.
createToDo();if(tasks.
isSupportedField(Event.
SUMMARY))singleTask.
addString(ToDo.
SUMMARY,PIMItem.
ATTR_NONE,"ShoppingforHalloween");if(tasks.
isSupportedField(Event.
DUE))singleTask.
addDate(ToDo.
DUE,PIMItem.
ATTR_NONE,newDate().
getTime());try{singleTask.
commit();}catch(PIMExceptione){//Anerroroccured}try{tasks.
close();}catch(PIMExceptione){developerWorksibm.
com/developerWorks/J2MEPersonalInformationManagement(PIM)-AnOverviewPage4of7}HowPIMdiffersfromRMSBeforegoingfurtheronthisdiscussion,letusreviewtheconceptofRecordManagementStore(RMS),anotherkeyfunctionalitybyJ2ME.
RMSallowsJ2MEapplicationstopersistentlystoredatalocally.
ThecomponentsofRMSareasfollows:Records–UnliketheDatabasesystemswhereeachrecordhasoneormorefields,aRecordinRMSisanindividualdatafield.
Itdoesnothaveapre-defineddatatypeorsizeandcancontainanydata.
RecordStore–ARecordStoreisacollectionofRecordsandisaccessiblefromJ2MEapplicationsbyname.
ThisishowPIMdiffersfromRMSwhilebothareresponsibleforstoringpersistentdataonthedevice.
1.
PIMstoresandretrievesdatatoandfromdefinedentitiesliketheAddressBook,CalendarandTaskList.
RMS,ontheotherhand,storesdatatoandretrievesdatafromageneraldatabase.
AsingleentityinPIMisaContact,CalendarentryoraTaskwhileinRMS,it'sabytearray.
2.
PIMisnotrestrictedtothelocaldevice.
ItcanaccessdatafromanattachedSIMoranotherremotedevice.
RMSonlyaccessesdatatoandfromlocaldevice.
3.
PIMcanexportandimportfromexternalsourceslikevCalendarorvContact.
RMSdoesnothaveanyExportorImportcapabilities.
4.
TheinterpretationofdatainPIMismoreflexiblecomparedtoRMS.
Say,aContact,definedinastandardformat,canalwaysbeinterpretedbyanotherJ2MEapplicationwithease.
ArecordinRMSisabytearrayandotherJ2MEapplicationswillneedtohaveinformationonhowtointerpret.
Anexample–AddacontactInthissection,wewilldiscussamethodmentionedasaddContact()onhowtoaddacontacttotheAddressBook.
ThismethodasinCode-4canbeinvokedinaseparatethreadwhenausercommandissubmittedontheform.
ThismethodaccessesdataenteredthroughUITextfields.
Listing4.
addContact()method//Importimportjavax.
microedition.
lcdui.
*;importjavax.
microedition.
midlet.
*;importjavax.
microedition.
pim.
*;//TextinputTextFieldnameField;TextFieldphoneField;…publicvoidaddContact(){ibm.
com/developerWorks/developerWorksJ2MEPersonalInformationManagement(PIM)-AnOverviewPage5of7ContactListcontacts=null;try{contacts=(ContactList)PIM.
getInstance().
openPIMList(PIM.
CONTACT_LIST,PIM.
READ_WRITE);}catch(PIMExceptione){//Anerroroccurrede.
printStackTrace();}Contactcontact=contacts.
createContact();String[]name=newString[contacts.
stringArraySize(Contact.
NAME)];if(contacts.
isSupportedArrayElement(Contact.
NAME,Contact.
NAME_GIVEN))name[Contact.
NAME_GIVEN]=nameField.
getString();if(contacts.
isSupportedField(Contact.
TEL))contact.
addString(Contact.
TEL,Contact.
ATTR_HOME,phoneField.
toString());try{contact.
commit();}catch(Exceptione){}}RuntimeandsecurityconsiderationsThePIMMIDletshouldberuninaconfigurationthatsupportsPIMi.
e.
JSR75.
WeselectedthebelowsettingsonSun'sWirelessToolkit2.
5byclickingSettingsandthenAPISelection.
ThesameappliestoselectionofmobiledevicesforPIMMIDlettorun.
developerWorksibm.
com/developerWorks/J2MEPersonalInformationManagement(PIM)-AnOverviewPage6of7Figure1.
PIMMIDletRuntimeAPISelectionTheMIDletwillrequireadditionalpermissionswhileattemptingtoreadandwritetheContacts,CalendarorTaskLists.
ThiscanbeaccomplishedbyclickingSettingsandselectingPermissionsfromtheWirelesstoolkit.
AlltheReadandWritepermissionsforContactList,EventListandTodoListhavebeenprovided.
ibm.
com/developerWorks/developerWorksJ2MEPersonalInformationManagement(PIM)-AnOverviewPage7of7Figure2.
PIMMIDletSecurityconsiderationsConclusionInthisarticlewediscussedaboutanotherimportantfunctionalityinJ2MEcalledPersonalInformationManagement(PIM)thatallowsaccesstothenativedataonthemobiledeviceintheformofContact,TaskandEvent.
ItalsodrawsacomparisonwithRMS,anotherfunctionalitythatdealswithdevicedata.
Withtheinherentexportandimportcapabilities,itisnowpossibletosyncupJ2MEapplicationswithvCardandvCalendar,theinternetstandardformatforContactandCalendarrespectively.
Weconcludedwiththesecurityanddeploymentrequirementsatruntime.
CopyrightIBMCorporation2009(www.
ibm.
com/legal/copytrade.
shtml)Trademarks(www.
ibm.
com/developerworks/ibm/trademarks/)

CloudCone 新增洛杉矶优化线路 年付17.99美元且简单线路测试

CloudCone 商家在以前的篇幅中也有多次介绍到,这个商家也蛮有意思的。以前一直只有洛杉矶MC机房,而且在功能上和Linode、DO、Vultr一样可以随时删除采用按时计费模式。但是,他们没有学到人家的精华部分,要这样的小时计费,一定要机房多才有优势,否则压根没有多大用途。这不最近CloudCone商家有点小变化,有新人洛杉矶优化线路,具体是什么优化的等会我测试看看线路。内存CPU硬盘流量价格...

Gcore(gcorelabs)俄罗斯海参崴VPS简单测试

有一段时间没有分享Gcore(gcorelabs)的信息了,这是一家成立于2011年的国外主机商,总部位于卢森堡,主要提供VPS主机和独立服务器租用等,数据中心包括俄罗斯、美国、日本、韩国、新加坡、荷兰、中国(香港)等多个国家和地区的十几个机房,商家针对不同系列的产品分为不同管理系统,比如VPS(Hosting)、Cloud等都是独立的用户中心体系,部落分享的主要是商家的Hosting(Virtu...

HostKvm四月优惠:VPS主机全场八折,香港/美国洛杉矶机房$5.2/月起

HostKvm是一家成立于2013年的国外主机服务商,主要提供基于KVM架构的VPS主机,可选数据中心包括日本、新加坡、韩国、美国、中国香港等多个地区机房,均为国内直连或优化线路,延迟较低,适合建站或者远程办公等。本月商家针对全场VPS主机提供8折优惠码,优惠后美国洛杉矶VPS月付5.2美元起。下面列出几款不同机房VPS主机产品配置信息。套餐:美国US-Plan0CPU:1cores内存:1GB硬...

tooogooo为你推荐
kaixin.com人人网和开心网互通,可我用的是kaixin001的开心,和kaixin*com不是一个呀!8090lu.com《8090》节目有不有高清的在线观看网站啊?www.5ff.comhttp://www.940777.com/网站,是不是真的网投六合www.zjs.com.cn请问宅急送客服电话号码是多少?www.vtigu.com如图所示的RT三角形ABC中,角B=90°(初三二次根式)30 如图所示的RT三角形ABC中,角B=90°,点p从点B开始沿BA边以1厘米每秒的速度向A移动;同时,点Q也从点B开始沿BC边以2厘米每秒的速度向点C移动。问:几秒后三角形PBQ的面积为35平方厘米?PQ的距离是多少m.kan84.net经常使用http://www.feikan.cc看电影的进来帮我下啊lcoc.top服装英语中double topstitches什么意思bbs2.99nets.com这个"风情东南亚"网站有78kg.cn做网址又用bbs.风情东南亚.cn那么多此一举啊!partnersonline电脑内一切浏览器无法打开ww.66bobo.com这个WWW ̄7222hh ̄com是不是真的不太易开了,换了吗?
便宜虚拟主机 猫咪永久域名收藏地址 到期域名查询 2019年感恩节 表单样式 12306抢票攻略 一点优惠网 免费ddos防火墙 国外免费空间 铁通流量查询 godaddy域名证书 双拼域名 vip购优汇 seednet asp免费空间申请 稳定免费空间 美国免费空间 搜索引擎提交入口 彩虹云 美国凤凰城 更多