ArticlesTutorialsInterview Questions & AnswersCertificationsFree Books & Sample ChaptersTechnical Discussions  Your Account | Advertise with us | Feedback |
Brew Interview Questions

add to:
Y! MyWeb
31.Can incoming SMS messages be emulated with the SDK?

SMS emulation will be available in version 1.1 of the BREW SDK.

32.What settings are required to allow a running BREW application to be suspended when a non-BREW SMS message is received on the Sharp Z-800?

On the Sharp Z-800 handset, you must set the following in order to receive non-BREW SMS:

Main Menu -> Setup/Tool -> BREW Setting -> OFF.

33.When making a voice call using ITAPI_MakeVoiceCall, responding No to the Privacy Alert hangs the application. What is the workaround?

This is a bug in BREW SDK version 1.0.1, and will be fixed in an upcoming release.
The recommended workaround for BREW SDK Version 1.0.1 is for the user to press 'No' twice (i.e. press Select Key twice). When the Privacy Alert Yes/No dialog is displayed, all key events up until the first Select key press go to the Dialog. After the first Select key (for the dialog), subsequent key events go to the application.

Steps are outlined below:

  1. Added a boolean 'madeVoiceCall' in the Applet structure
  2. If ITAPI_MakeVoiceCall() returns Success, set madeVoiceCall to TRUE
     retValue = ITAPI_MakeVoiceCall(pMe->p_tapi, PHONE_NUM,
    if(retValue == SUCCESS) {
    pMe->madeTapiCall = TRUE;

  3. Handle EVT_KEY in the app handler function. If the Select key was pressed and madeVoiceCall is TRUE, the user has selected No in response to the Privacy Alert. Set madeVoiceCall = FALSE and redraw screen.
     case EVT_KEY:
    if (wParam == AVK_SELECT && pMe->madeTapiCall ==
    TRUE) {
    // Redraw screen
    pMe->madeTapiCall = FALSE;
    return TRUE;

  4. If the user selected 'Yes' to the Privacy Alert, the application would have been suspended. When resumed, the madeVoiceCall flag must be cleared.
     case EVT_APP_RESUME:
    if(pMe->madeTapiCall == TRUE) {
    pMe->madeTapiCall = FALSE;
    return TRUE;
34.After making a voice call using ITAPI_MakeVoiceCall, why does my application seem to be restarted when I respond 'No' to the "Return to Application" prompt?

Make sure that the parameter clsReturn (application to start when the call ends) in the call to ITAPI_MakeVoiceCall is 0 (zero). If you specify clsReturn as your app's Class ID, then BREW tries to create another instance of your app, rather than resume your app.

35.What guidelines should follow when making a voice call immediately after a data call?

After the last socket is released, BREW waits for the network linger time (default linger time is 30s) to expire before terminating the PPP connection. The actual tearing down of the PPP connection takes about 3s. Therefore, (linger time + 3 seconds) must elapse between releasing the last socket and invoking ITAPI_MakeVoiceCall(). You should introduce a (linger time + 3 seconds) timer between releasing the last socket and making the voice call.

For example:


//LINGER_TIME below is in seconds

ISHELL_SetTimer(pMe->a.m_pIShell, (LINGER_TIME +3) * 1000,
Timer_CB, (void *)pMe);

In the timer callback code, you can make the voice call using ITAPI_MakeVoiceCall().

Note:   In BREW SDK version 2.0, this 3-second lag is built into BREW. The application will not need to implement the additional 3 seconds in its timer.

36.When making a voice call immediately after a data call, why do we see the Privacy Alert again instead of "Return to Application"?

Refer to above FAQ
In addition to the more common causes, stack overrun can also lead to SWI Exceptions.
Note:   It is recommended that large buffers be allocated on the heap rather than on the stack as automatic variables.

37.How do I obtain the phone number of the device on which my application is running?

An application can obtain the phone number of the device on which it is running by calling ITAPI_GetStatus(). The phone number is in TAPIStatus.szMobileID.

For example:

 TAPIStatus tapiStat;


if (ITAPI_GetStatus(pMe->p_tapi, &tapiStat) == EBADPARM) {

DisplayOutput((IApplet*)pMe, 6, "TAPI Status fetch failed");


DisplayOutput((IApplet*)pMe, 4, "Mobile ID:");

DisplayOutput((IApplet*)pMe, 5, tapiStat.szMobileID);


38.When will BREW offer HTTP Support?

HTTP Support is available through the AEEWeb interface in version 1.1 of the BREW SDK and above. With earlier versions of the SDK, use the ISocket interface to connect to a server's HTTP port, and send HTTP "get" and "post" requests.

39.Why does GetHostByName() not work on my phone?

For INETMGR_GetHostByName() to function correctly, the phone's Domain Name Server (DNS) settings must be properly configured. This is generally taken care of by the Service Provider, in which case the phone should be returned to the place of purchase, or an authorized service center so that its DNS settings can be properly configured.

40.Why do we get the value of in dnsresult.addrs when I use GetHostByName()?

This may be due to incorrect implementation of error handling in the GetHostByName() callback function. The error handling implementation in the GetHostByName() callback of the NetSocket example is incorrect. You can use the following sample implementation:

 if(pMe->dnsresult.nResult > 0 && pMe->dnsresult.nResult
// DNS lookup  success
// Process dnsresult.addrs
for(i = 0; i < pMe->dnsresult.nResult; i++)  {
         SPRINTF(szMsg,"Addr=: %x",pMe->dnsresult.addrs[i]);
} else {
// DNS Failure - error code is dnsresult.nResult
SPRINTF(szMsg, "DNS: error %d", pMe->dnsresult.nResult);
      DisplayOutput(pMe, 2, szMsg);

41.With no TCP/IP Flush command available in BREW, how can I confirm that a command is sent right away?

It is not possible to determine when a TCP/IP command is sent; BREW does not provide this capability.

42.What is the largest packet size supported by BREW?

The maximum packet size is OEM dependant, and may vary from one manufacturer's phone to another. BREW has no control over this limitation.

43.When transmitting large files, do we have to break the file up into packets before sending, or does BREW do this for me?

You should simply send what you can, and ISOCKET_Write() will tell you how much data was actually sent. If there is data remaining to be sent, simply offset your data pointer by the amount indicated by your last call to ISOCKET_Write().

For Example:

 void CommonWriteCB (void *pUser) {
char *psz = NULL;
      int  cbWrite;

SampleApp * pMe = (SampleApp*)pUser;

// pszData is the data to be written
psz = pszData;
cbWrite = STRLEN (pszData);

// Loop till all the bytes are written.
while (cbWrite > 0) {
rv = ISOCKET_Write(pMe->m_pISocket, (byte *)psz,

// No byte were written successfully. Register
// callback to try again later.
CommonWriteCB, (void *)pMe);
} else if (rv == AEE_NET_ERROR) {
// Write Error.

// In case of parital write, loop and write the rest
cbWrite -= rv;
psz += rv;

44.How many sockets can be opened simultaneously?

This limit is OEM specific, and will vary depending on the device that your applet is running on---it is not set by BREW.

Note:  Multiple TCP sockets are not supported on the Kyocera 3035. It allows one TCP socket and one UDP socket at a given time.

45.Are network callbacks invoked in the context of the main thread, and if so how is the data integrity preserved in the current context?

All network callbacks occur within the same thread context, at some point in time after the caller returns control to the AEE event loop. If your application is busy doing something, callbacks will be queued, then invoked once your application returns control to the AEE event loop, ensuring data integrity..

Back to top


Add this FAQs to :
Spurl Slashdot
Y! MyWeb


About Us | Our Mission | Terms of use | Author Terms |    Search        | Contact Us | Advertise With Us | Link to Us | Sitemap
Copyright © 2016 developersBOOK.COM. All rights reserved.