|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE task |
|
11 PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"> |
|
12 <task id="GUID-4E1B057E-5291-54FC-A0C0-37234CBFBD8E" xml:lang="en"><title>Enumerating |
|
13 Applications</title><shortdesc>Device creators can use the APIs provided by APPARC to enumerate |
|
14 a list of applications on a device. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody> |
|
15 <steps id="GUID-A733DF2E-4FC5-5CBF-8F32-B5D43847FC0B"> |
|
16 <step id="GUID-9439F626-0F50-59C9-B87F-3FAE9AF3C9C9"><cmd/> |
|
17 <info>Create a session with the APPARC server using the <xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita#GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA/GUID-A92887D0-694C-3792-B3C9-46B155FE83B9"><apiname>RApaLsSession::Connect()</apiname></xref>. </info> |
|
18 <stepxmp><codeblock id="GUID-88901791-698A-5790-8742-8AA01F96E09E" xml:space="preserve">RApaLsSession apaLsSession; |
|
19 |
|
20 // Connect to the APPARC server |
|
21 User::LeaveIfError(apaLsSession.Connect()); |
|
22 </codeblock> </stepxmp> |
|
23 </step> |
|
24 <step id="GUID-22D84B52-B95F-5D95-AF17-669BC8D6923E"><cmd/> |
|
25 <info>Implement one or more of the following functions as per your requirement: </info> |
|
26 <substeps id="GUID-F8155F75-6D02-5AC8-9B8D-BB73AC591FC4"> |
|
27 <substep id="GUID-49F98C14-2DF3-55B2-AEF5-3D0CBA78320F"><cmd/> |
|
28 <info> <xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita#GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA/GUID-70BFF68B-3563-3FAD-807C-895984620E2A"><apiname>RApaLsSession::GetAllApps()</apiname></xref> - Use this function |
|
29 to initialize the process of getting all applications in the list except the |
|
30 control panel applications. </info> |
|
31 </substep> |
|
32 <substep id="GUID-FDB73E93-2F2C-5090-BE29-85633F3F0F95"><cmd/> |
|
33 <info> <xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita#GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA/GUID-E0F9B1FA-976A-3A07-8A69-1713F81CE146"><apiname>RApaLsSession::GetEmbeddableApps()</apiname></xref> - Use this function |
|
34 to initialize the process of getting all the embeddable applications in the |
|
35 list except the control panel applications. </info> |
|
36 </substep> |
|
37 <substep id="GUID-5ECEDBB8-8C07-5EF5-A052-1C11E208BDF5"><cmd/> |
|
38 <info> <xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita#GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA/GUID-32AFB430-CFBA-3E1F-A396-198FEFDA7B29"><apiname>RApaLsSession::GetFilteredApps()</apiname></xref> - Use this function |
|
39 to initialize the process of getting all the filtered applications in the |
|
40 list except the control panel applications. </info> |
|
41 </substep> |
|
42 <substep id="GUID-A3769C11-1003-50E4-B0ED-4B38B0C1761B"><cmd/> |
|
43 <info> <xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita#GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA/GUID-866EBCF7-A570-3B98-A0C8-5402E75952DB"><apiname>RApaLsSession::GetServerApps()</apiname></xref> - Use this function |
|
44 to initialize the process of getting all the server applications in the list |
|
45 except the control panel applications. </info> |
|
46 </substep> |
|
47 </substeps> |
|
48 </step> |
|
49 <step id="GUID-B26025A2-FCDE-5469-B843-4815F71903B4"><cmd/> |
|
50 <info>Call the <xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita#GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA/GUID-A3FAD085-07BF-3048-A6DB-300AAB88C8CB"><apiname>RApaLsSession::GetNextApp()</apiname></xref> to get one application |
|
51 at a time. </info> |
|
52 <info>The <xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita#GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA/GUID-A3FAD085-07BF-3048-A6DB-300AAB88C8CB"><apiname>RApaLsSession::GetNextApp()</apiname></xref> must be called in |
|
53 loop to get information about the next application in the list. The application |
|
54 information is stored in <xref href="GUID-B5CD60A5-F371-3D9D-AB2D-652CA41D9158.dita"><apiname>TApaAppInfo</apiname></xref> variable. If there |
|
55 are no more applications present in the list, <codeph>ENoMoreAppsInList</codeph> message |
|
56 is returned. </info> |
|
57 <info>The following code snippet shows how to get a list of all the applications |
|
58 on the device: </info> |
|
59 <stepxmp><codeblock id="GUID-DF44AF8D-8E8D-53E1-9BD4-18D60D23BA84" xml:space="preserve">// Get the list of all the applications on the device |
|
60 |
|
61 TInt ret = apaLsSession.GetAllApps(); |
|
62 if(ret==KErrNone) |
|
63 { |
|
64 TApaAppInfo appInfo; |
|
65 |
|
66 // Retrieve the next application in the list. |
|
67 // appInfo contains the application information |
|
68 |
|
69 while((ret= apaLsSession.GetNextApp(appInfo)) == KErrNone); |
|
70 |
|
71 |
|
72 // Make sure ENoMoreAppsInList is returned at the end of list. |
|
73 |
|
74 if(ret==RApaLsSession::ENoMoreAppsInList) |
|
75 { |
|
76 // No more applications in the list |
|
77 } |
|
78 }</codeblock> </stepxmp> |
|
79 <info>The following code snippet shows how to get a list of all the server |
|
80 applications on the device: </info> |
|
81 <stepxmp><codeblock id="GUID-8B32EDC3-1F06-5357-9334-1CFD95B8C44C" xml:space="preserve">// Get the list of all the server applications on the device |
|
82 |
|
83 TInt ret = apaLsSession.GetServerApps(); |
|
84 if(ret==KErrNone) |
|
85 { |
|
86 TApaAppInfo appInfo; |
|
87 |
|
88 // Retrieve the next application in the list which provides a service. |
|
89 |
|
90 while((ret= apaLsSession.GetNextApp(appInfo)) == KErrNone); |
|
91 |
|
92 |
|
93 // Make sure ENoMoreAppsInList is returned at the end of list. |
|
94 |
|
95 if(ret==RApaLsSession::ENoMoreAppsInList) |
|
96 { |
|
97 // No more server applications in the list |
|
98 } |
|
99 }</codeblock> </stepxmp> |
|
100 <info>The following code snippet shows how to get a list of all the embedded |
|
101 applications on the device: </info> |
|
102 <stepxmp><codeblock id="GUID-E3BC41F9-8B50-59CB-891C-90F9EB27B954" xml:space="preserve">// Get the list of all the embedded applications on the device |
|
103 |
|
104 TInt ret = apaLsSession.GetEmbeddedableApps(); |
|
105 if(ret==KErrNone) |
|
106 { |
|
107 TApaAppInfo appInfo; |
|
108 |
|
109 // Retrieve the next embedded application in the application list |
|
110 |
|
111 while((ret= apaLsSession.GetNextApp(appInfo)) == KErrNone); |
|
112 |
|
113 |
|
114 // Make sure ENoMoreAppsInList is returned at the end of list. |
|
115 |
|
116 if(ret==RApaLsSession::ENoMoreAppsInList) |
|
117 { |
|
118 // No more embedded applications in the list |
|
119 } |
|
120 }</codeblock> </stepxmp> |
|
121 <info>The following code snippet shows how to get a list of all the filtered |
|
122 applications on the device: </info> |
|
123 <stepxmp><codeblock id="GUID-57572B8E-94CA-5948-BFE9-7A8AF7DBABA0" xml:space="preserve">// Get the list of all the application based on the filter defined in the parameter passed to it. |
|
124 |
|
125 TApaEmbeddabilityFilter &filter = TApaEmbeddabilityFilter(); |
|
126 filter.AddEmbeddability(TApaAppCapability::EEmbeddableUiOrStandAlone); |
|
127 |
|
128 TInt ret = apaLsSession.GetFilteredApps(filter); |
|
129 if(ret==KErrNone) |
|
130 { |
|
131 TApaAppInfo appInfo; |
|
132 |
|
133 // Retrieve the next application in the application list that matches the specified filter. |
|
134 |
|
135 while((ret= apaLsSession.GetNextApp(appInfo)) == KErrNone); |
|
136 |
|
137 |
|
138 // Make sure ENoMoreAppsInList is returned at the end of list. |
|
139 |
|
140 if(ret==RApaLsSession::ENoMoreAppsInList) |
|
141 { |
|
142 // No more filtered applications in the list |
|
143 } |
|
144 }</codeblock> </stepxmp> |
|
145 </step> |
|
146 </steps> |
|
147 </taskbody><related-links> |
|
148 <link href="GUID-940F3F6E-BA9C-5E19-9AC5-D848B5E175FB.dita"><linktext>Application |
|
149 Architecture Overview</linktext></link> |
|
150 </related-links></task> |