Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Power management considerations

In addition to speed and memory consumption, Brew MP application developers should be mindful of power consumption. Performance in regards to power consumption on mobile devices can be characterized by the conservation of battery life without compromising the quality of the user experience. This section provides information on ways devices can reduce power consumption.

Reduce unnecessary timers

Power-efficient code should use timers wisely to minimize wake-ups. Unnecessary timer wake-ups can cause poor power consumption.

Brew Low Power Mode

Brew Low Power Mode (BLPM) is a state in which Brew MP lets device power optimization algorithms operate without having to handle user interaction with the mobile device. BLPM can save battery power, but at the cost of diminished application performance. For more information, see Brew low power mode.

Shut down VOCODER after media playback

Unless the manufacturer specifically implements this feature, VOCODER is normally not shut-down after media playback. This prevents devices from going into the sleep state to conserve battery life. To avoid this problem, it is recommended that applications playing media shut down VOCODER through ISound UNMUTE/MUTE, as follows:

  1. Create an ISound instance.
  2. Get the current sound settings, including the current audio device and mute control settings.
  3. Set mute controls (EAR or MIC only for recording app ) to UNMUTE before the playback starts.
  4. Set mute control settings to MUTE when playback is done, aborted, or stopped.
  5. Release the ISound instance.

For example:

//create an ISound instance
ISHELL_CreateInstance(pMe->piShell, AEECLSID_SOUND, (void**)&pMe->piSound) 

//set up IMedia callback
ISOUND_RegisterNotify(pMe->piSound, (PFNMEDIANOTIFY ) Media_Callback,pMe);
IMedia_Play(pMe->piMedia);

void Media_Callback(MyApp *pMe, AEEMediaCmdNotify * pCmdNotify){
   if (MM_CMD_PLAY == pCmdNotify->nCmd) {      
      switch (pCmdNotify->nStatus) {
      case MM_STATUS_START:
      {
         //UNMUTE the device path
         AEESoundInfo   si;
         if(pMe->piSound) {
            ISound_Get(pMe->piSound, &si);
            si.eEarMuteCtl = AEE_SOUND_MUTECTL_UNMUTED;
            ISound_Set(pMe->piSound, &si);
            ISound_SetDevice(pMe->piSound);
         }
         break;
      }
      case MM_STATUS_DONE:
      case MM_STATUS_ABORT:
      {
         //MUTE the device path
         AEESoundInfo   si;
         if(pMe->piSound) {
            ISound_Get(pMe->piSound, &si);
            si.eEarMuteCtl = AEE_SOUND_MUTECTL_MUTED;
            ISound_Set(pMe->piSound, &si);
            ISound_SetDevice(pMe->piSound);
         }
         break;
      }
      default:
         break;
      }
   }
}

// Release ISound instance
RELEASEIF(pMe->piSound);