0

I use Htc's phone. My phone's lock screen can show the icons which are added in my main screen's bottom bar. The bar allow me add app and shortcut. If I type the password to unlock my phone,it took me 10 second. So I have a thinking:

I write a app to create a shortcut and the shortcut can broadcast to the record app to start record.

{ Intent shortCutContain =new Intent("example.app.REC"); shortCutContain.setClassName("example.app", "example.app.AudioService"); shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,shortCutContain); }

this is what I do......but it failed

Please help me

JamieZ
  • 41
  • 3

1 Answers1

0

Here's the code to start the recorder:

Intent intent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION);
startActivityForResult(intent, RQS_RECORDING);

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
if(requestCode == RQS_RECORDING){
savedUri = data.getData();
Toast.makeText(AndroidIntentAudioRecording.this,"Saved: " + savedUri.getPath(),
Toast.LENGTH_LONG).show();
 }
} 

Put this code on your onCreate() if you want to launch the recorder automatically.

113408
  • 3,144
  • 5
  • 24
  • 50
  • thanks your answer. But the record app I am using which can save to many format. So I want to send the action to record app. – JamieZ Jun 01 '12 at 17:19
  • You want to launch a 3rd app. check this post : http://stackoverflow.com/questions/2780102/open-another-application-from-your-own-intent – 113408 Jun 01 '12 at 17:22
  • The record app can add a widget on main screen.The widget send PendingIntent to AudioService to record without open activity.But the post or example articles only told me how to "startActivity". – JamieZ Jun 02 '12 at 06:23