java - IntentService's onDestroy method getting called straight after onHandleIntent -


i have intentservice using record audio via audiorecord in app. in onhandleintent method, call .getinstance of seperate class used handling recording, , call couple of methods of class.

however intentservice starts, ondestroy method gets called, , recording stops. in class gets instantiated in onhandleintent, audio still recording, until ondestroy gets called. surely ondestroy shouldn't called until recording finished.

if offer suggestion why doing this, appreciated.

the code intentservice below:

public class recordservice extends intentservice {     public file directory;     audiorecord audiorecord;     int samplerate = 44100;     int channelconfiguration = audioformat.channel_in_mono;     int audioencoding = audioformat.encoding_pcm_16bit;     file file;     short channels = 1;     int bitspersample = 16;     public recordservice() {         super("record");     }     extaudiorecorder extaudiorecord;      @override     protected void onhandleintent(intent intent) {          log.v("record", "record called");         extaudiorecord = extaudiorecorder.getinstanse(false);         extaudiorecord.reset();         extaudiorecord.setoutputfile(getoutputfile("recv2").tostring());         extaudiorecord.prepare();          extaudiorecord.start();         //record();     }     public void ondestroy(){         extaudiorecord.stop();         //audiorecord.stop();         log.v("record", "ondestroy called, record stopped");      } 

i believe extaudiorecord.start(); non-blocking meaning returns exiting onhandleintent(). intentservice terminated shortly after calling ondestroy.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -