BREW (Binary Runtime Environment for Wireless) Interview Questions & Answers

BREW (Binary Runtime Environment for Wireless) Interview Questions

Need to change your career to brew (Binary Runtime Environment for Wireless)? Then we will offer you with all the essential entity for you to clear the interview in Brew (Binary Runtime Environment For Wireless) jobs. With our jobs portal, you will find the number of jobs associated with you along with the Brew (Binary Runtime Environment For Wireless) Interview Questions and Answers. There are numerous leading companies that offer jobs in several roles like Ab Initio Engineer, Brew (Binary Runtime Environment For Wireless) Analyst, Quality Assurance Solutions Engineer, Technical Support Engineer and many other roles too. To save the time in order to read all the topics on different websites we have covered all topics in one place by means question and answers. For more details on Brew (Binary Runtime Environment For Wireless) feel free to visit our site

BREW (Binary Runtime Environment For Wireless) Interview Questions And Answers

BREW (Binary Runtime Environment for Wireless) Interview Questions
    1. Question 1. How To Transfer Compiled Applications To A Phone?

      Answer :

      Use BREW AppLoader to upload applications to the phone. The following example shows files and locations for an application with the name " brewApp."

      /brew/ brewApp.mif

      • Generated by BREW MIF Editor.

      /brew/ brewApp/

      • Generated by BREW Resource Editor.

      /brew/ brewApp/ brewApp.mod

      • Compiled and linked with ARM BREW Builder.

      /brew/ brewApp/ brewApp.sig

      • Digital Signature.

      All directory and file names on the phone must be in lower case. Any additional files specific to your application may also be copied to the application directory, or subdirectories of the application directory.

      The Digital Signature file is generated using the BREW TestSig Generator, then renamed with the name of the application. The first part of the .sig filename must be the same as the first part of the .mod filename.

      After uploading files, reset the phone.

    2. Question 2. How To Compile An Application To Run On A Handset?

      Answer :

      To build applications for the phone requires the ARM Developer Suite of tools, which are used to compile and link a project that has been developed using the PC-based BREW SDK, and related tools. Running an application built using the ARM tools requires a BREW-enabled phone, a data cable for establishing a serial connection to the phone, and file copying software such as QUALCOMM's BREW AppLoader application. See How to Build a Downloadable BREW Application for more details.

    3. Question 3. How To Upload A Device Configurator File (.qsc) To A Phonethe ?

      Answer :

      The device configurator file (.qsc) is used by the BREW Emulator application, and is not required to run applications on the phone.

    4. Question 4. How To Debug Output On Emulator And Phone?

      Answer :

      When an application is running on the BREW Emulator, DBGPRINTF outputs messages to the Visual C++ Debug Window. Currently, DBGPRINTF messages are not available while running on a phone. Support for outputting debug messages to a host PC via serial connection is under development.

    5. Question 5. What Compilers Can Be Used To Compile Brew Applications?

      Answer :

      The ARM BREW Builder can be used to compile BREW applications.

    6. Question 6. What Guidelines Should Be Followed When Compiling An Application In Thumb Mode?

      Answer :

      function AEEMod_Load() must be moved to a different source file and this file must be compiled in ARM mode. AEEMod_Load() must always be compiled in ARM mode.

      All files that are compiled in thumb mode MUST have the INTERWORK compiler option turned on. If this option is NOT turned on in the make file, the app will very likely crash.

    7. Question 7. What To Do If We Installed Arm Brew Builder Or Arm Development Suite Into A Path With Spaces?

      Answer :

      The solution is to modify your makefile in the following fashion:

      • Comment out the ARMBIN, ARMINC, and ARMLIB declaration.
      • Add the full path to the ARMCC, LD, and HEXTOOL variables. Make sure you double quote the path.

    8. Question 8. What Are The Operating System Requirements Of The Brew Sdk?

      Answer :

      Due to the requirement for Unicode support, the SDK runs only on the Microsoft Windows NT™ 4.0, Windows 2000™ and Windows XP™ platforms. Windows 98 is not supported by the BREW SDK.

    9. Question 9. Does Brew Support Multi-threading?

      Answer :

      BREW does not support multi-threading. BREW does have support for cooperative multi-tasking.

    10. Question 10. Can We Link To Windows Dlls From The Sdk?

      Answer :

      No. You should treat the SDK as a fully integrated stand-alone platform, which includes avoiding the C Standard Libraries. BREW has provided a port of the most common functions.

    11. Question 11. On What Devices Is Brew Supported?

      Answer :

      Currently, support for BREW is only available for devices based on the following QUALCOMM chipsets: MSM3100, MSM3300, MSM5000, MSM5100, and MSM5105. In addition, for a particular phone or other device to support BREW, it must be "BREW enabled" with a version of the BREW runtime provided by the device's manufacturer.

    12. Question 12. What Events Must An Applet Handle?

      Answer :

      In addition to the obvious EVT_APP_START and EVT_APP_STOP, your applet must support EVT_APP_SUSPEND and EVT_APP_RESUME in order to pass True BREW Testing.

    13. Question 13. What Difference Is There Between Using The Phone's "end" Key To Close An Applet, And Using The "clear" Key To Close An Applet?

      Answer :

      A key, that when pressed, will close the current application. Most OEMs designate this to be the AVK_CLR key.

      • A key, that when pressed, will close all applications. Most OEMs designate this to be the AVK_END key.
      • When AVK_END is pressed, BREW will immediately send EVT_APP_STOP to the active applet without first sending the AVK_END key. In addition, the FreeAppData() callback routine provided to AEEApplet_New() will be called prior to unloading the applet; no other events or callbacks will occur.
      • When AVK_CLR is pressed, BREW will first send this event to the applet. If the applet does not handle the event (i.e. returns FALSE in HandleEvent), only then BREW will close the application. In the implementation of your AVK_CLR handler, remember to also call FreeAppData as follows:

      case AVK_CLR:

      if (pMe->OnMainMenu == TRUE) {
      // App is on main menu. Therefore pressing CLR key should cause app to exit
      HelloWorld_FreeAppData(pi); //clean up
      return FALSE; //return FALSE so that BREW will now close application
      else { // Not on main menu.
      // Therefore pressing CLR key should cause app to undo one level of menu
      // nesting. Show previous menu in menu hierarchy
      return TRUE;
      Make sure that your FreeAppletData() properly cleans up all allocated memory and resources. All objects and interfaces created by CreateInstance, CreateDialog, MALLOC, etc., must have an associated call to Release or FREE.

    14. Question 14. How Do I Deal With A Low Battery Warning?

      Answer :

      BREW sends the running application an EVT_APP_SUSPEND event in the case of a Low Battery Warning. In order to handle low battery condition, you must correctly handle EVT_APP_SUSPEND and EVT_APP_RESUME events.

    15. Question 15. What Is The Difference Between Ishell_sendevent() And Ishell_ Postevent()?

      Answer :

      XML is no way clashes with HTML, since they are for two different purposes.

      ISHELL_SendEvent() :

      • In the case of ISHELL_SendEvent(), the event is immediately sent to the application of the specified Class ID. If an instance of that class is not currently present, the AEE Shell creates one, and then invokes its IAPPLET_HandleEvent() function with the specified event code and data parameters. Unless it chooses to start itself, the application terminates after it completes processing of the event.
      • The ISHELL_SendEvent() function allows for control over the destination applet. This function sends the event directly to the destination applet.

      ISHELL_PostEvent() :

      • ISHELL_PostEvent() is similar, except that the destination class's IAPPLET_HandleEvent() function is not called immediately. The event is placed in a queue and is sent at a later time, which allows the calling application to continue its processing without interruption.
      • The processing of events posted using ISHELL_PostEvent() is deferred until the next iteration of the event loop. This is useful in providing continued execution while allowing other events to be processed.

    16. Question 16. What Notification Events Can An App Register For?

      Answer :


      • TAPI (Class ID: 0x01001007)
      • 0x0001
      • TAPI Status change event
      • 0x0002
      • Incoming SMS
      • 0x0004
      • SMS message on specific Teleservice ID
      • INETMGR
      • 0x0001
      • Network layer is available
      • 0x0002
      • Network layer is closed
      • NMASK_IDLE
      • 0x0004
      • Network layer available and idleNote

    17. Question 17. How To Test Application For Proper Handling Of Suspend/resume Events On A Non- Provisioned Phone?

      Answer :

      On the Kyocera 3035, you can test your app's handling of Suspend/Resume events by enabling automatic Keyguard (Main Menu->Settings->Keyguard) before running your app. When the Keyguard kicks in, the running app will receive a Suspend Event. The app will receive Resume event when the screen is unlocked.

      On the Sharp Z-800, you can test your app's handling of Suspend/Resume events by setting the alarm to go off a few minutes in the future (Main Menu->Setup/Tools->Alarm->Daily Alarm) and then running the BREW app. Please note that in order for the app to be suspended when the alarm goes off, BREW Priority Setting must be off (Main Menu->Setup/Tools->BREW Priority Setting).

    18. Question 18. How To Recover The Phone From An "undefined Exception"?

      Answer :

      "Undef Inst Exception" stands for "undefined instruction exception," and means that the program pointer has jumped to a code segment that contains an undefined instruction. This can be the result of memory corruption, a stack overrun, or version-related incompatibilities between applet code and the BREW image on the phone.

      Memory is tighter on the phone than when running on the emulator. Therefore, memory and stack overrun problems will be more likely to show up on the phone. You should double check memory related areas of your code, especially auto variable arrays and the maximum total size of allocated memory. To clear the phone, pull the battery out for a few seconds.

    19. Question 19. What Is A "re-entrant Data Abort?

      Answer :

      "The "Re-entrant Data Abort" exception is often caused by stack overrun. When an applet is running on the phone the stack size is small, and you are more likely to see stack overrun problems than when running on the emulator. Solutions to this problem are reducing the size or number of objects on the stack, and using objects allocated on the heap instead of automatic variables.

      Note: Version-related incompatibilities between applet code and the BREW image on the phone can also lead to this type of exception.

    20. Question 20. What Is A "pref Abort Exception?

      Answer :

      "A "Pref Abort Exception" usually indicates that memory important to the phone operating system has been trashed. The two most common causes of this exception are data corruption (i.e. running off the end of an array), and stack overruns.

    21. Question 21. What Is An "swi Exception?"

      Answer :

      An "SWI Exception" is usually related to heap memory mismanagement. The most common causes of heap memory corruption are: overwriting the bounds of your allocated arrays, freeing objects more than once, and writing to wild or NULL pointers. 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.

    22. Question 22. Why Does The Emulator Display A Blank Screen With My Application's Name When My Application Exits?

      Answer :

      Problem: When an application exits while running on the emulator, instead of returning to the main menu screen, a blank screen is displayed with the application name in the upper left corner.

      This behavior is caused by not freeing all allocated memory before exiting the application. Any buffer you allocate using MALLOC or IHEAP_Malloc() must be freed using FREE or IHEAP_Free(). For any instance of a BREW class that you create, you must call the corresponding release function to free that instance.

    23. Question 23. How Does The Memory Architecture In Brew Work?

      Answer :

      BREW device has Flash RAM and Heap RAM. You can treat Flash RAM as a hard drive. Programs are stored there, but not run from it. You can treat Heap RAM as you would always treat a memory heap. Say you have an application that is 35k in size. This will take 35k from the Flash RAM to store on the device. When the application is run, the 35k will be loaded into Heap RAM in its entirety plus however much Heap RAM it needs to allocate. When the applet is released, this Heap RAM is freed. It will still occupy space on the Flash RAM until it is removed from the device.

    24. Question 24. What Is The Size Limit For An Applet?

      Answer :

      The size of a BREW applet is limited by the amount of free file system space that is available, and by the amount of available RAM.

      BREW applets, when executed, are loaded into RAM; any RAM left over can be used for memory allocation, loading resources, creating controls, etc. How much RAM is available depends on the type of phone, and its configuration. On a QCP-3035, for instance, the available RAM is 90K, 30K of which belongs to BREW and other phone related tasks, leaving 60K available for use by an applet. The memory available on each of the phones running BREW is available here.

      Another limiting factor for applet size is heap fragmentation. If the largest available memory block is smaller than the size of the applet, then the applet will not be loaded. Use IHEAP_CheckAvail() to determine whether a memory block of sufficient size can be allocated. IHEAP_GetMemStats() can be used to determine the amount of RAM already used. If you have an applet that is too large for a particular device, a work-around is to split the application into multiple applets. Memory Allocation provides more information on how to avoid heap fragmentation.

      Note: In order test a low memory condition on the BREW Emulator reduce the heap size in the Device Configuration file by the appropriate amount. BREW's System Info screen reports the amount of available flash memory, not the amount of available RAM.

    25. Question 25. Why Can't An Applet Be Run Directly From Flash Ram?

      Answer :

      BREW loads the apps into Heap RAM because files on EFS are stored as non- contiguous blocks.

    26. Question 26. What's The Difference Between Malloc() And Iheap_malloc() Function In Brew-sdk?

      Answer :

      MALLOC and IHEAP_Malloc() are identical, just as FREE and IHEAP_Free() are identical. In earlier versions of the BREW SDK, malloc was part of the IHEAP Interface, and was later made into a helper function for ease of use. Both are still available for backward compatibility, but it is recommended that, use MALLOC and FREE rather than IHEAP_Malloc() and IHEAP_Free().

      An app needs to create IHeap interface only when it wants to get current memory usage statistics (IHEAP_GetMemStats()) or check if a memory block of a certain size can be allocated (IHEAP_CheckAvail()).

    27. Question 27. How To Test An Application On The Emulator To Determine If It Behaves Properly Under Low Memory Conditions?

      Answer :

      This can be achieved by reducing the heap size in the device configurator file (.qsc file) to almost the size of the .mod file. Any run time allocations by the applications should fail and you can test if your application deals with those failures correctly.

      • Since the size of the mod file a is a lot less then the dll that runs in the emulator, the emulator approximates the size of the mod file to be 10% of dll.
      • To properly run this test, create a separate directory that contains only the MIF of the application under test and have emulator point to this new directory (File->Change MIF Dir).

    28. Question 28. How To Send Sms Messages From A Brew Application?

      Answer :

      Currently, BREW does not expose a means to send SMS messages from within a BREW applet. BREW applications can only receive SMS messages.

    29. Question 29. Can An Sms Message Be Sent To An Inactive Applet?

      Answer :

      Yes, SMS notification events can be delivered to an application, even if it is not currently active. To do so, BREW first loads the applet, and then sends the EVT_APP_MESSAGE event to it. The application may start itself by calling ISHELL_StartApplet(), or can "silently" process the event without calling ISHELL_StartApplet().

    30. Question 30. Can Incoming Sms Messages Be Emulated With The Sdk?

      Answer :

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

    31. Question 31. 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?

      Answer :

      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.

    32. Question 32. When Making A Voice Call Using Itapi_makevoicecall, Responding No To The Privacy Alert Hangs The Application. What Is The Workaround?

      Answer :

      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:

      • Added a boolean 'madeVoiceCall' in the Applet structure
      • If ITAPI_MakeVoiceCall() returns Success, set madeVoiceCall to TRUE

      retValue = ITAPI_MakeVoiceCall(pMe->p_tapi, PHONE_NUM,
      if(retValue == SUCCESS) {
      pMe->madeTapiCall = TRUE;

      • 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;

      • 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;

    33. Question 33. 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?

      Answer :

      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.

    34. Question 34. What Guidelines Should Follow When Making A Voice Call Immediately After A Data Call?

      Answer :

      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.

    35. Question 35. When Making A Voice Call Immediately After A Data Call, Why Do We See The Privacy Alert Again Instead Of "return To Application"?

      Answer :

      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.

    36. Question 36. How Do I Obtain The Phone Number Of The Device On Which My Application Is Running?

      Answer :

      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);

    37. Question 37. When Will Brew Offer Http Support?

      Answer :

      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.

    38. Question 38. Why Does Gethostbyname() Not Work On My Phone?

      Answer :

      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.

    39. Question 39. Why Do We Get The Value Of In Dnsresult.addrs When I Use Gethostbyname()?

      Answer :

      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);

    40. Question 40. With No Tcp/ip Flush Command Available In Brew, How Can I Confirm That A Command Is Sent Right Away?

      Answer :

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

    41. Question 41. What Is The Largest Packet Size Supported By Brew?

      Answer :

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

    42. Question 42. When Transmitting Large Files, Do We Have To Break The File Up Into Packets Before Sending, Or Does Brew Do This For Me?

      Answer :

      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,
      if (rv == AEE_NET_WOULDBLOCK) {
      // 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;
      … … …

    43. Question 43. How Many Sockets Can Be Opened Simultaneously?

      Answer :

      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.

    44. Question 44. Are Network Callbacks Invoked In The Context Of The Main Thread, And If So How Is The Data Integrity Preserved In The Current Context?

      Answer :

      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..

    45. Question 45. When Reading From A Socket The Phone Reads Whatever It Can In One Go, While The Emulator Reads Large Packets In Chunks. Why?

      Answer :

      This is a limitation of the phone.

      Program should call ISOCKET_Readable() to be informed when more data can be read from the stream. The callback routine registered by ISOCKET_Readable() will be invoked whenever data becomes available---you can usually call ISOCKET_Read() at this point. Continue calling ISOCKET_Readable() for as long as your program expects more data.

      rv = ISOCKET_Read(piSock, (byte *)szBuf, sizeof(szBuf));
      if (rv == AEE_NET_WOULDBLOCK) {
      // WOULDBLOCK => no more data available at the moment
      // Register the callback to read the data later.
      ISOCKET_Readable(piSock, CommonReadCB, (void*)pMe);
      else if (rv == AEE_NET_ERROR) {
      // error reading from socket
      ReleaseNetAndSocket (pMe);
      else if (rv > 0) { 
      // rv bytes of data has been read from the socket into
      // szBuf
      // Read remaining data
      ISOCKET_Readable(piSock, CommonReadCB, (void*)pMe); 
      else { // rv == 0
      // There is no more data to be received.
      // The peer has shut down the connection.
      ReleaseNetAndSocket (pMe);

    46. Question 46. How Can We Check The Status Of My Sockets And Ppp Connection?

      Answer :

      We can check on the status of the PPP connection (active, inactive, opening or closing) using INETMGR_NetStatus().

      NetState netState = NET_INVALID_STATE;
      AEENetStats netStats;
      netState = INETMGR_NetStatus (pINetMgr, &netStats);
      We can use INETMGR_OnEvent() to monitor both the status of the PPP connection and socket connections. Refer to NetMgrEvent enum in AEENet.h for a list of all network and socket events.
      // Register to receive Network and Socket events
      INETMGR_OnEvent(piNet, (PFNNETMGREVENT)CheckNetStatus,
      (void*)pMe, TRUE);
      //Callback invoked when Network/Socket event is received
      static void CheckNetStatus(void* cxt,
      NetMgrEvent evt, uint32 dwData) {
      SampleApp *pMe = (SampleApp*)cxt;
      if(evt == NE_PPP) { 
      // network event. dwData = NetState enum value
      // refer NetState data structure in BREW API Reference doc
      if(evt == NE_SO_CLOSING || evt == NE_SO_CLOSED) {
      // socket event - closing or closed. 
      // DwData is pointer to socket
      … …

    47. Question 47. Is It Possible To Transfer Data Between Two Phones?

      Answer :

      Peer to peer connections between two phones have been found to be unreliable, failing when the phones are on the same subnet. It is best therefore to use a proxy server, transferring data between the phones using the server as a go between.

    48. Question 48. Can A Brew-enabled Device Be Used As A Server?

      Answer :

      In addition to the obvious memory and performance limitations, it is not possible to listen on a socket connection when a BREW application is running on a phone. These factors make implementing a server on BREW difficult at best.

    49. Question 49. Is There Any Way To Tell If A Socket Is Already Connected?

      Answer :

      There are two ways to determine if a socket is connected. The easiest is to check the return value of ISOCKET_Connect(). When a socket is already connected, ISOCKET_Connect() will return EISCONN.

      It is also possible to monitor the state of a socket connection by registering for the socket status change events NE_SO_CLOSING, and NE_SO_CLOSED with INETMGR_OnEvent(). Using this method, your application can avoid trying to connect an already connected socket.

      For more information about network and socket events, including NE_SO_CLOSING and NE_SO_CLOSED, please refer to the following include file: AEENet.h

      For Example:

      // Register to receive Network and Socket events
      INETMGR_OnEvent(piNet, (PFNNETMGREVENT)CheckNetStatus,
      (void*)pMe, TRUE);
      //Callback invoked when Network/Socket event is received
      static void CheckNetStatus(void* cxt, NetMgrEvent evt,
      uint32 dwData)
      SampleApp *pMe = (SampleApp*)cxt;
      if(evt == NE_SO_CLOSING || evt == NE_SO_CLOSED) {
      // flag set to false to indicate socket is disconnected
      pMe->m_SocketConnected = FALSE;
      if(evt == NE_SO_CONNECTED) {
      // flag set to true to indicate socket is connected
      pMe->m_SocketConnected = TRUE;

    50. Question 50. Why Does Isocket_release() Return One When We Are Expecting A Return Value Of Zero?

      Answer :

      When an application calls ISOCKET_Release(), the internal state of the ISocket object changes to "closing," and BREW begins waiting for the asynchronous "closed" event. Since the closed event is received in a callback, the reference count of the ISocket object is incremented to prevent it from being released before its internal state changes to closed.

    51. Question 51. Why Does Ishell_createinstance Return Eclassnotsupport When I Try And Create An Instance Of The Net Manager (aeeclsid_net)?

      Answer :

      This is because of the permissions on the MIF file for your applet. Please open your MIF file in the MIF editor and check the checkbox for Network privileges, then save

    52. Question 52. Can We Have A Listening Tcp Socket?

      Answer :

      No. You use UDP, specifically, ISOCKET_Bind and ISOCKET_RecvFrom

    53. Question 53. Does Brew Support Blocking Sockets?

      Answer :

      BREW uses asynchronous sockets. You can use ISOCKET_Readable or ISOCKET_Writeable to be notified when it is safe to read/write.

    54. Question 54. When We Terminate A Data Call By Closing An Open Socket, Why Does The Phone Still Indicate That A Data Call Is In Progress?

      Answer :

      After the last connected socket is closed, BREW waits for a certain linger time before terminating the PPP connection. Hence the lingering call-in-progress indication.

      The default linger time is 30 seconds. To change the linger time, use INETMGR_SetLinger().

    55. Question 55. Why Does Connect Callback Not Timeout When Service Is Lost (while Attempting To Connect) Or The Server Does Not Respond?

      Answer :

      This is due to a bug in the BREW version 1.0.1 SDK - connect callback is not invoked under the following circumstances:

      • Service is lost while connect is being attempted
      • Server does not respond

      As a workaround, you should implement a timer in association with the callback. If the connect callback does not occur in 30 seconds, you should timeout the connection.

      For example:

      // initialize pMe->connectCBInvoked = FALSE;
      // Set timer for 30 seconds before invoking ISOCKET_Connect()
      ISHELL_SetTimer(pMe->a.m_pIShell, 30000, ConnectTimeout_CB, (void *)pMe);
      ISOCKET_Connect(pMe->m_pISocket, nodeINAddr, AEE_htons(USAGE_TEST_PORT),
      SampleApp_ConnectCB, pMe);
      // Set flag indicating connect CB was called
      void SampleApp_ConnectCB(void *cxt, int err) {
      SampleApp *pMe = (SampleApp*)cxt;
      // Set flag indicating connect CB was called
      pMe->connectCbInvoked = TRUE;
      if (err) {
      DisplayOutput((IApplet*)pMe, 3, "Connect failed!");
      DisplayOutput((IApplet*)pMe, 3, "Connected!");
      // When timer expires, check if connect CB was invoked
      static void ConnectTimeout_CB(void* cxt) {
      SampleApp *pMe = (SampleApp *)cxt;
      if(pMe->connectCbInvoked == FALSE) {
      // Callback was not invoked within 30seconds - cancel connect callback
      ISOCKET_Cancel(pMe->m_pISocket, 0, 0);
      DisplayOutput((IApplet*) pMe, 3, "Connection timed out");
      else {
      // Callback invoked. Set flag to default value FALSE
      pMe->connectCbInvoked = FALSE;

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

    56. Question 56. What Precautions Should We Take When I Invoke Inetmgr_gethostbyname() To Perform Dns Lookup?

      Answer :

      You must ensure that your app cancels its pending DNS callback, if any, using CALLBACK_Cancel() in all exit routes. This includes when the app is suspended and when the app is stopped (both via the End key and the Clear key).

      For example, if you used the following code to lookup a DNS address:

      CALLBACK_Init(&pMe->cbkLookup, GetHostByNameCB, pMe);
      INETMGR_GetHostByName(pINetMgr,&pMe->dnsresult, hostName,
      You should use the following code to cancel the callback in all exit routes:
      // Check if the callback can be cancelled. If NULL it has
      // already happened and cannot be cancelled.
      if(pMe->cbkLookup.pfnCancel != NULL) {

      The callback cancel code should be incorporated in the Suspend event handler code ( EVT_APP_SUSPEND), the app's FreeAppData function (which is called when the app is stopped, i.e. receives EVT_APP_STOP event), and in the Clear key event handler code (EVT_KEY and keycode AVK_CLR).

      Note: Please note that your app will not pass TRUE BREW Testing if it does not properly cancel its pending DNS callback. Some symptoms that might indicate that your app is not canceling its p ending DNS callback are:,/p>

      • hone crashes upon starting up app
      • Phone displays "Please Re-insert Battery" error upon starting up app

      Both might imply that the previously running app did not cancel its pending DNS callback.

    57. Question 57. Are There Any Restrictions On What Value We Can Set My Application's Network Linger Time To?

      Answer :

      The INETMGR_SetLinger() function is provided to give developers flexibility in designing their application. However, it is not recommended that you alter the OEM's chosen default linger time (usually 30 seconds), unless your application has a compelling reason to do so. Altering the default linger time in either direction may cause your application to fail TRUE BREW Testing, or carrier rejection of your application.

    58. Question 58. What Image Formats Are Supported In Brew?

      Answer :

      BREW supports any BMP file with a color depth up to that which is provided on the device it is running on. BREW does not yet support GIF and JPEG images. For now, you need to convert GIF and JPEG images into BMP images. PNG format and BREW Compressed Image (BCI) format will be supported in BREW SDK version 1.1.

      In SDK versions prior to 1.1, the emulator is capable of emulating only 1, 4, and 8 bit color depth BMPs. In version 1.1, the emulator can also display 2 bit color depth BMPs

    59. Question 59. What Is The Transparent Color On Color And Monochrome Phones?

      Answer :

      Magenta is the transparent color for color devices. White is the transparent color on monochrome and 4-level gray-scale devices.

    60. Question 60. How Can We Move The Cursor To The End Of The Text Input?

      Answer :

      The cursor can be moved to the end of the string by continuously invoking ITEXTCTL_HandleEvent() method n times on the string, where n is the length of the string.
      For example:

      while(len) {
      ITEXTCTL_HandleEvent(pMe->m_pIText, EVT_KEY,
      AVK_RIGHT, dwParam);

      Note: This does not currently work on the Kyocera 3035, unless dwParam is set to 10 (corresponds to AVK_RIGHT). Kyocera is working on fixing this issue such that dwParam will not need to be explicitly set. Setting dwParam = 10 will not have any adverse affect on the Sharp Z-800 handset.

      A new API - ITEXTCTL_SetCursorPos(), will be added in BREW SDK version 1.2 to set the Text Control's cursor position.

    61. Question 61. How Can We Create A Text Control With Horizontal And Vertical Scrollbars?

      Answer :

      If the text is larger than the Text Control size, then a vertical or horizontal scrollbar will appear and you can navigate through the text using the directional keys.

    62. Question 62. Why Do We Get Memory Errors Such As "memheap.c 0696" When Using Idisplay_bitblt() To Draw A Bitmap Image?

      Answer :

      Ensure that you are freeing the memory allocated by CONVERTBMP. Check the last Boolean parameter of CONVERTBMP. If True, a reallocation was done and the memory must be freed using SYSFREE.

      For example:

      pBmp = CONVERTBMP (pDataBytes, &imageInfo, &bVal);
      IDISPLAY_BitBlt (pIDisplay, xDest, yDest, cxDest,
      cyDest, pBmp, xSrc, ySrc, dwRopCode);
      IDISPLAY_Update (pIDisplay);
      if(bVal) //free only if realloc was done
      SYSFREE (pBmp);

    63. Question 63. How Can We Suppress The Title Area From Showing On My Istatic?

      Answer :

      The title area cannot currently be suppressed in SDK version 1.0. This has been added in BREW version 1.1.

    64. Question 64. How Can We Determine The Character Limit For The Display Of Application Names On The Phone?

      Answer :

      Different phones have different display characteristics, so there is no unique answer to this question. You can determine whether your application name will fit on the phone's display by comparing the width of the application name to the width of the display.

      Use IDISPLAY_MeasureText() to determine the pixel width of your application name string. Use ISHELL_GetDeviceInfo() to determine the pixel width of the screen

    65. Question 65. Does Brew Support Animation?

      Answer :

      BREW SDK version 1.0 includes support for animated BMP. This is done by placing the frames side-by-side and specifying the width of each frame with IIMAGE_SetParm with the IPARM-CXFRAME flag. Please see the IIMAGE example in the Examples directory

      BREW SDK Version 1.1 has added support for BREW Compressed Image (BCI) animation. A BCI file contains one or more compressed small graphic image(s), each with a specified duration in milliseconds. The duration represents how long you want each image to be shown before it is replaced by the next image in the series. You can use the BCI Authoring Tool included in BREW SDK Version 1.1 to create your BCI file. Please refer to 'Using the BREW Compressed Image Authoring Tool' document included in the SDK for more information.

    66. Question 66. How Can We Control Animation By Time?

      Answer :

      One way to do this is to use the IImage interface and set the rate of animation (IImage_SetParm).

      An example in which the animation rate is set to 750ms is shown below:

      IIMAGE_SetParm(pMe->m_pIImage, IPARM_RATE, 750, 0);

      You can also use a timer to trigger the image display function. Use ISHELL_SetTimer() to set a timer:

      ISHELL_SetTimer(pMe->a.m_pIShell, TIMER_RATE, (PFNNOTIFY)(ManipulateBitmap), pMe);

      After TIMER_RATE ms expires, ManipulateBitmap function will be triggered, within which you can manipulate your image.

    67. Question 67. What Is The Difference Between Multi-tap And T9 Text Entry Modes For Text Input?

      Answer :

      In Multi-tap mode, a key must be tapped several times in order to specify a letter. For example, to specify the letter 'r', tap the number '7' three times. In T9 mode, a key is tapped only once per letter. T9 Text Input determines the most commonly used word matching the input numeric sequence. If more than once word matches the sequence, the most common word is selected, with the ability to scroll to the next most commonly used word.

      The default text entry mode is Multi-tap. T9 text entry mode is not supported on the emulator.

    68. Question 68. How Can We Draw A Line In A Specific Color?

      Answer :

      IDISPLAY_DrawHLine() and IDISPLAY_DrawVLine() always draw lines in black. Therefore setting CLR_USER_LINE to the desired color and then invoking IDISPLAY_DrawHLine() or IDISPLAY_DrawVLine() will not work.

      The definitions of these two IDISPLAY macros are below. To draw a line in a color other than black, use the code contained in the macro definition and change to the desired fill color.

      #define IDISPLAY_DrawHLine(p,x,y,len)
      {AEERect rc;SETAEERECT(&rc,(x),(y),(len),1); IDISPLAY_FillRect((p),&rc,
      #define IDISPLAY_DrawVLine(p,x,y,len)
      {AEERect rc;SETAEERECT(&rc,(x),(y),1,(len)); IDISPLAY_FillRect((p),&rc,

    69. Question 69. How Can We Create A Dialog?

      Answer :

      Use the BREW Resource Editor to create a dialog. You can also construct the dialog manually by creating data structures in your application to define the contents of the dialog.

      Note: If a bmp file is being used, make sure that the bmp format is supported and that the bmp file is a valid full path, all in lowercase. 

      Once the dialog has been created, it will have a resource ID and a resource file (.bar file). Use ISHELL_CreateDialog() to create the dialog:

      ISHELL_CreateDialog(pMe->a.pIShell, SAMPLEAPP_RES_FILE,


      // SAMPLEAPP_RES_FILE is the resource file (.bar file) and
      // RESOURCE_ID is the resource ID specified in the resource
      // editor

      Process the following events (return TRUE at the very least) in the app handler function:

      case EVT_DIALOG_START:
      return TRUE;
      case EVT_DIALOG_INIT:
      return TRUE;
      case EVT_DIALOG_END:
      return TRUE;

      Call ISHELL_EndDialog when the dialog object is no longer needed. ISHELL_EndDialog(pMe->a.pIShell);

    70. Question 70. How Can We Create A Scroll Bar If Menu Is Larger Than The Screen Size?

      Answer :

      The screen rectangle in which the menu is to be drawn (specified by IMENUCTL_SetRect) must exceed the screen height by at least the height of a single menu item. Otherwise the menu item will be clipped and no scroll bar will appear.

    71. Question 71. How Cancwe Add Images To The Items In An Imenuctl?

      Answer :

      We can use the IMENUCTL_AddItemEx method with CtlAddItem structure.

    72. Question 72. Can We Remove The Multitap Item From The Softkey Menu Associated With My Text Control?

      Answer :

      Yes, We can remove it by following the steps outlined below:

      • Associate the soft key menu with your text control using ITEXTCTL_SetSoftKey().
      • Call IMENUCTL_DeleteAll() to delete the Multitap item.
      • Add items using IMENUCTL_AddItem().

    73. Question 73. Is It Possible To Get/manipulate The Palette Information Of The Device?

      Answer :

      No. The palettes are hard-coded by the vendor and will vary from device to device.

    74. Question 74. Can We Modify The Display Buffers Directly?

      Answer :

      No. There is no way for BREW to access these and the display data is stored as the vendor's proprietary format.

BREW (Binary Runtime Environment for Wireless) Related Tutorials

BREW (Binary Runtime Environment for Wireless) Related Interview Questions

BREW (Binary Runtime Environment for Wireless) Related Practice Tests

Popular Interview Questions

All Interview Questions

All Practice Tests

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

Wireless Security Tutorial