How to solve the problem of launch the apps twice or more?

by Mark Murphy » Wed, 21 Apr 2010 18:49:53 GMT


Sponsored Links
 


Please don't do that.

First, it's not possible:

 http://www.androidguys.com/2009/09/09/diamonds-are-forever-services-are-not/ 

Second, it's a bad idea to even try:

 http://www.androidguys.com/2010/03/29/code-pollution-background-control/ 


What is "it"?

Services are natural singletons -- there is exactly 0 or 1 copy of the
service running at any point. The goal is for there to be 0 copies of
the service running unless it is actively delivering user-perceived value.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

_Beginning Android 2_ from Apress Now Available!

--



Other Threads

1. android 2.0 <-> blackberry messenger

is there an app or is anyone working on a app that will allow verizon
droid users to send/receive blackberry messenger messages?

--

2. android audio issue

Hi,
   i am using android SDK 1.5, below is the code where i am recording
voice from mic and playing it.

problems i am facing are :
 voice quality is not good,
 some background voice is there,
 write is getting blocked.

  i have set the permission in .xml file also like :
                   android.permission.INTERNET,
                   android.permission.MODIFY_AUDIO_SETTINGS,
                   android.permission.RECORD_AUDIO,
android.permission.WRITE_SETTINGS

help required

below is the code :
 to record the audio i am using read() and to play write() is being
called.
is my code correct ?

   public void onCreate(Bundle savedInstanceState)
   {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);

       byte[] Buffer = new byte [80000] ;

       int Size = 320 ;
       int BuffLen = 1 ;
       int     SizeSoFar = 0 ;
       int MinBuffSize ;
       int Written = 0 ;
       int temp = 0 ;

       AudioRecord audioRecord = new AudioRecord
(MediaRecorder.AudioSource.MIC, 8000,
 
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT, 4096) ;
       audioRecord.startRecording () ;

       MinBuffSize = AudioRecord.getMinBufferSize(8000,2,2);

       AudioTrack track = new AudioTrack (AudioManager.STREAM_MUSIC,
8000,
 
AudioFormat.CHANNEL_CONFIGURATION_MONO ,
AudioFormat.ENCODING_PCM_16BIT,
                       4096, AudioTrack.MODE_STREAM) ;

       track.play() ;

       while (BuffLen != 0)
       {
                SizeSoFar += audioRecord.read (Buffer, 0, Size) ;

               Written = track.write (Buffer, 0, Size) ;
               try
               {
                       Thread.sleep (5) ;
               }
               catch (InterruptedException e)
               {
                       // TODO Auto-generated catch block
                       e.printStackTrace() ;
               }
       }
       audioRecord.stop() ;
       track.stop() ;
   }

help required .






logcat message are :

D/AudioHardware(  556): AudioStreamInGeneric::set(0xad68, 7, 1, 1,
8000)
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408040, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408180, 320)
from fd 7
W/AudioFlinger(  556): AudioRecordThread: buffer overflow
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408040, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408180, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408040, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408180, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408040, 320)
from fd 7
W/AudioFlinger(  556): AudioRecordThread: buffer overflow
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408180, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408040, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408180, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408040, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408180, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408040, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408180, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408040, 320)
from fd 7
W/AudioFlinger(  556): AudioRecordThread: buffer overflow
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408180, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408040, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408180, 320)
from fd 7
W/AudioFlinger(  556): AudioRecordThread: buffer overflow
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408040, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408180, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408040, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408180, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408040, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408180, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408040, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408180, 320)
from fd 7
W/AudioFlinger(  556): AudioRecordThread: buffer overflow
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408040, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408180, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408040, 320)
from fd 7
W/AudioFlinger(  556): AudioRecordThread: buffer overflow
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408180, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408040, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408180, 320)
from fd 7
D/AudioHardware(  556): AudioStreamInGeneric::read(0x40408040, 320)
from fd 7
W/AudioFlinger(  556): AudioRecordThread: buffer overflow

-- 

3. Delay to write first video frame

4. G1 brick

5. how to call shell script from init.rc

6. How to get all the log from phone reboot to IDLE

7. Change ListView Color