I was looking for examples.
My class look like:
<pre><code>
package com.example.pjimnez.samsung_auto_reply;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.telephony.PhoneStateListener;
import android.telephony.SmsManager;
import android.telephony.TelephonyManager;
import android.widget.Button;
import android.widget.TextView;
import android.view.View;
import android.widget.Toast;
import android.content.Intent;
import android.content.IntentFilter;
public class MainActivity extends AppCompatActivity {
//IntentFilter screenStateFilter;
Button btnStart;
TextView txtHome;
//PhoneState oPhoneState;
IntentFilter filter1;
private final BroadcastReceiver myPhoneState = new BroadcastReceiver() {
#Override
public void onReceive(Context context, Intent intent) {
String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
if (state == null) {
//Outgoing call
String number = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
Toast.makeText(context, number, Toast.LENGTH_LONG).show();
} else if (state.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) {
//Log.e("tag", "EXTRA_STATE_OFFHOOK");
Toast.makeText(context, "EXTRA_STATE_OFFHOOK", Toast.LENGTH_LONG).show();
} else if (state.equals(TelephonyManager.EXTRA_STATE_IDLE)) {
//Log.e("tag", "EXTRA_STATE_IDLE");
Toast.makeText(context, "EXTRA_STATE_IDLE", Toast.LENGTH_LONG).show();
} else if (state.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
//Incoming call
String number = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);
//Log.e("tag", "Incoming number : " + number);
Toast.makeText(context, number, Toast.LENGTH_LONG).show();
} else
Toast.makeText(context, "none", Toast.LENGTH_LONG).show();
}
};
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
filter1 = new IntentFilter(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
registerReceiver(this.myPhoneState, filter1);
btnStart = (Button) findViewById(R.id.btnStart);// Instancia del objeto boton intro
//No funciona en modo escucha
btnStart.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
txtHome = (TextView) findViewById(R.id.txtHome);
txtHome.setText("Dio click en el boton!" );//cambio el contenido del TextView
//Envia el mensahe SMS
/*
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage("5524234613", null, "Mensaje de prueba", null, null);
*/
}
});
}
}
enter code here
</code></pre>
My manifest has permissions to:
android.permission.READ_PHONE_STATE
android.permission.RECEIVE_SMS
android.permission.SEND_SMS
The problem is that my app never show the message on phone change state
i do not know whats is wrong with the BroadcastReceiver
Could you helpme
Try this:
1- add a class PhoneStateBroadcastReceiver which extends BroadcastReceiver and overwrite onReceive()
2- at runtime, request PHONE_STATE permission upfront
ActivityCompat.requestPermissions(myMainActivity,
new String[]{Manifest.permission.READ_PHONE_STATE},
READ_PHONE_STATE_CODE);
and give it via the system dialog
3- make a phone call
You'll see the intent caught in onReceive():
intent: Intent { act=android.intent.action.READ_PHONE_STATE flg=0x10 cmp=com.myApp.network.PhoneStateBroadcastReceiver (has extras) }
Action: android.intent.action.PHONE_STATE
Hope it helps
Related
I have built full voice recorder application.
I would like to start recording when a voice call starts on the phone, how can I detect the Calls state? tried some code and it didn't work for me.
I just need to know hot to start recording when a voice call starts (incoming and outgoing).
Here is an example of what you need.
Declare receiver in AndroidManifest
<receiver android:name=".IncomingCall">
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE" />
</intent-filter>
</receiver>
Give read phone state permission in AndroidManifest
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
Create a class IncomingCall with extends BroadcastReceiver class
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.widget.Toast;
/**
* Created by matheszabi on Aug/20/2017 0020.
*/
public class IncomingCall extends BroadcastReceiver {
private Context context;
public void onReceive(Context context, Intent intent) {
this.context = context;
try {
// TELEPHONY MANAGER class object to register one listner
TelephonyManager tmgr = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
//Create Listner
MyPhoneStateListener PhoneListener = new MyPhoneStateListener();
// Register listener for LISTEN_CALL_STATE
tmgr.listen(PhoneListener, PhoneStateListener.LISTEN_CALL_STATE);
} catch (Exception e) {
Log.e("Phone Receive Error", " " + e);
}
}
private class MyPhoneStateListener extends PhoneStateListener {
public void onCallStateChanged(int state, String incomingNumber) {
Log.d("MyPhoneListener",state+" incoming no:"+incomingNumber);
if (state == 1) {
String msg = "New Phone Call Event. Incomming Number : "+incomingNumber;
int duration = Toast.LENGTH_LONG;
Toast toast = Toast.makeText(context, msg, duration);
toast.show();
}
}
}
}
Above Android 6.0 you need to handle a bit different the permissions:
import android.Manifest;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
private static final int MY_REQUEST_CODE = 1234;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
#Override
protected void onResume() {
super.onResume();
if (checkSelfPermission(Manifest.permission.READ_PHONE_STATE)
!= PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.READ_PHONE_STATE},
MY_REQUEST_CODE);
}
}
public void onRequestPermissionResult(int requestCode, String[] permissions, int[] grantResults) {
if (requestCode == MY_REQUEST_CODE) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// Now user should be able to use camera
Toast.makeText(this, "I have access", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "I DON'T have access", Toast.LENGTH_SHORT).show();
}
}
}
}
You must allow the permissions at the first time run:
Here is the screenshot of the working code:
I found how to do so:
package com.example.tsuryohananov.mycallrecorder;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.widget.Toast;
/**
* Created by tsuryohananov on 20/08/2017.
*/
public class MyPhoneReceiver extends BroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent) {
Bundle extras = intent.getExtras();
if (extras != null) {
String state = extras.getString(TelephonyManager.EXTRA_STATE);
Log.d("MY_DEBUG_TAG", state);
if (state.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
String phoneNumber = extras.getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
Log.d("MY_DEBUG_TAG", phoneNumber);
// here i need to save the number for the listview.
}
if ((state.equals(TelephonyManager.EXTRA_STATE_OFFHOOK))){
String phoneNumber = extras.getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
Toast.makeText(context,"Answered" + phoneNumber, Toast.LENGTH_SHORT).show();
MainActivity.recordStart();
}
if (state.equals(TelephonyManager.EXTRA_STATE_IDLE)){
Toast.makeText(context,"Idle State", Toast.LENGTH_SHORT).show();
MainActivity.stopRecord();
}
}
}
}
Is it possible to call the Intent.ACTION_CALL in the background ?
I want my application to call but I don't want it to put in the background, I want it to stay in the foreground while it is calling.
The Intent.ACTION_CALL will call the default Android Phone activity and call the number you provided. If you want your App to be in the foreground, which i take to understanding you are builder your own calling app, you will have to implement the Calling part yourself.
Otherwise you can launch your activity with say a 5 seconds delay if you just want to show the user a context of your application.
You can invoke your activity after making a call using this,
package com.sdi.androidcall;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends Activity {
Button call;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
call = (Button) findViewById(R.id.call);
final PhoneCallListener phoneListener = new PhoneCallListener();
final TelephonyManager telephonyManager = (TelephonyManager) this
.getSystemService(Context.TELEPHONY_SERVICE);
call.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
try {
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:" + phoneNumber));
startActivity(callIntent);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
}
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
#Override
public void run() {
telephonyManager.listen(phoneListener,
PhoneStateListener.LISTEN_CALL_STATE);
}
}, 10000);
}
});
}
private class PhoneCallListener extends PhoneStateListener {
boolean flag = true;
String LOG_TAG = "Call TEST";
#Override
public void onCallStateChanged(int state, String incomingNumber) {
if (TelephonyManager.CALL_STATE_RINGING == state) {
Log.i(LOG_TAG, "number: " + incomingNumber);
}
if (TelephonyManager.CALL_STATE_OFFHOOK == state) {
Log.i(LOG_TAG, "OFFHOOK");
// invoking activity
if (flag) {
Intent i = getBaseContext().getPackageManager()
.getLaunchIntentForPackage(
getBaseContext().getPackageName());
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
System.out.println("flagged retrieving app");
flag = false;
}
}
if (TelephonyManager.CALL_STATE_IDLE == state) {
Log.i(LOG_TAG, "IDLE");
Log.i(LOG_TAG, "restart app");
}
}
}
}
The activity will be called after a delay of 10 seconds here using PhoneStateListener
You need to specify the intent permissions in the mainfest as
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Try it, let me know if worked.
I have want to develop an sms notifier. The thing is when SMS is receiced a textbox in the activity just change to "SMS Received" text.
SMS is successfully sending but BroadCastReceiver is not working, please help.
my code:
package com.shahid.todolist;
import android.os.Bundle;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.SmsManager;
import android.telephony.SmsMessage;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/*
* SmsManager smsManager = SmsManager.getDefault();
*
* String sendTo = "03129912287"; String myMessage =
* "Android supports programmatic SMS messaging!";
* smsManager.sendTextMessage(sendTo, null, myMessage, null, null);
*/
final EditText phoneNo = (EditText) findViewById(R.id.phoneNo);
final TextView display = (TextView) findViewById(R.id.txtDisplay);
Button buttonOne = (Button) findViewById(R.id.button1);
buttonOne.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
SmsManager smsManager = SmsManager.getDefault();
display.setText("Sending SMS...");
String sendTo = phoneNo.getText().toString();
String myMessage = "This is Shahid from Android";
smsManager.sendTextMessage(sendTo, null, myMessage, null, null);
}
});
// ---
final BroadcastReceiver receiver = new BroadcastReceiver() {
private static final String queryString = "#echo ";
private static final String SMS_RECEIVED = "android.provider.Telephony.SMS_RECEIVED";
#Override
public void onReceive(Context context, Intent _intent) {
if (_intent.getAction().equals(SMS_RECEIVED)) {
display.setText("SMS Received");
}
}
};
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
You have to register your broadcast when it is within your activity.
#Override
protected void onResume() {
IntentFilter filter = new IntentFilter();
filter.addAction(BroadcastReceiver.SMS_RECEIVED); // Provide you intent filter for message received.
registerReceiver(receiver, filter);
super.onResume();
}
#Override
protected void onPause() {
unregisterReceiver(receiver);
super.onPause();
}
In case this helps someone, in my case the problem was that I was using special characters like brackets in my text. Once I removed those characters it started working
i got some problem with checkout weather device is connected with PC or not? so i have found that intent action ACTION_UMS_CONNECTED is used to get flag to check weather device is connected with PC or not.
i have tried one example but i cant able to get any flag.... I have past code here
package com.Mediamount;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.widget.Toast;
public class Mediamount extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
IntentFilter filter = new IntentFilter();
this.registerReceiver(mIntentReceiver, filter);
}
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
#Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
boolean queryRestart = false;
if (action.equals(Intent.ACTION_UMS_CONNECTED)) {
Toast.makeText(getBaseContext(), "asdasd", Toast.LENGTH_LONG).show();
} else if (action.equals(Intent.ACTION_SCREEN_ON)) {
} else if (action.equals(Intent.ACTION_SCREEN_OFF)) {
} else if (action.equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)) {
}
}
};
}
Is there anything are missing in manifest file so please tell me.
Update:
package com.Mediamount;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.widget.Toast;
public class Mediamount extends Activity {
public static BroadcastReceiver mReceiver1 = null;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
IntentFilter mIntentFilter = new IntentFilter(Intent.ACTION_UMS_CONNECTED);
// install an intent filter to receive SD card related events.
IntentFilter intentFilter1 = new IntentFilter
(Intent.ACTION_MEDIA_MOUNTED);
intentFilter1.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
intentFilter1.addAction(Intent.ACTION_MEDIA_SCANNER_STARTED);
intentFilter1.addAction(Intent.ACTION_MEDIA_SCANNER_FINISHED);
intentFilter1.addAction(Intent.ACTION_MEDIA_EJECT);
// install an intent filter to receive UMS(USB) related events.
intentFilter1.addAction(Intent.ACTION_UMS_CONNECTED);
intentFilter1.addAction(Intent.ACTION_UMS_DISCONNECTED);
intentFilter1.addAction("USB_INTENT");
intentFilter1.addDataScheme("file");
mReceiver1 = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, context.toString(),Toast.LENGTH_LONG).show();
String action = intent.getAction();
if (action.equals(Intent.ACTION_MEDIA_MOUNTED)) {
//Toast.makeText(context, "SD Card mounted",Toast.LENGTH_LONG).show();
} else if (action.equals
(Intent.ACTION_MEDIA_UNMOUNTED)) {
// Toast.makeText(context, "SD Card unmounted",Toast.LENGTH_LONG).show();
} else if (action.equals
(Intent.ACTION_MEDIA_SCANNER_STARTED)) {
// Toast.makeText(context, "SD Card scanner started",Toast.LENGTH_LONG).show();
//System.out.println("SD Card scanner started");
} else if (action.equals
(Intent.ACTION_MEDIA_SCANNER_FINISHED)) {
// Toast.makeText(context, "SD Card scanner finished",Toast.LENGTH_LONG).show();
} else if (action.equals(Intent.ACTION_MEDIA_EJECT)) {
// Toast.makeText(context, "SD Card eject",Toast.LENGTH_LONG).show();
} else if(action.equals(Intent.ACTION_UMS_CONNECTED))
{
// Toast.makeText(context, "connected",Toast.LENGTH_LONG).show();
} else if(action.equals
(Intent.ACTION_UMS_DISCONNECTED)) {
// Toast.makeText(context, "disconnected",Toast.LENGTH_LONG).show();
}
// BONG_TEST }
}
};
registerReceiver(mReceiver1, intentFilter1);
}}
for long i am trying to develop an app which would inform the user of any incoming message via speech, i have three classes, TextSpeaker, Receiver and SpeakerService. When i start the app and click on Start button, i get runtime error:
06-21 13:54:36.088: ERROR/AndroidRuntime(528): Uncaught handler: thread main exiting due to uncaught exception
06-21 13:54:36.119: ERROR/AndroidRuntime(528): java.lang.RuntimeException: Unable to start service com.example.TextSpeaker.SpeakerService#43bb2ff8 with Intent { cmp=com.example.TextSpeaker/.SpeakerService }: java.lang.NullPointerException
06-21 13:54:36.119: ERROR/AndroidRuntime(528): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2882)
....
06-21 13:54:36.119: ERROR/AndroidRuntime(528): Caused by: java.lang.NullPointerException
06-21 13:54:36.119: ERROR/AndroidRuntime(528): at com.example.TextSpeaker.SpeakerService.onStart(SpeakerService.java:33)
06-21 13:54:36.119: ERROR/AndroidRuntime(528): at android.app.Service.onStartCommand(Service.java:306)
06-21 13:54:36.119: ERROR/AndroidRuntime(528): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2873)
06-21 13:54:36.119: ERROR/AndroidRuntime(528): ... 10 more
Here are my 3 classes:
TEXTSPEAKER CLASS:
package com.example.TextSpeaker;
import java.util.Locale;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import android.speech.tts.TextToSpeech.OnInitListener;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
// the following programme converts the text to speech
public class TextSpeaker extends Activity implements OnInitListener {
/** Called when the activity is first created. */
int MY_DATA_CHECK_CODE = 0;
public TextToSpeech mtts;
public Button button,stop_button;
//public EditText edittext;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
button = (Button)findViewById(R.id.button);
stop_button=(Button)findViewById(R.id.stop_button);
Intent myintent = new Intent();
myintent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
startActivityForResult(myintent, MY_DATA_CHECK_CODE);
//edit text=(EditText)findViewById(R.id.edittext);
}
public void buttonClickListener(View src){
switch(src.getId())
{
case(R.id.button):
Toast.makeText(getApplicationContext(), "The service has been started\n Every new message will now be read out", Toast.LENGTH_LONG).show();
startService(new Intent(this,SpeakerService.class));
break;
case(R.id.stop_button):
Toast.makeText(getApplicationContext(), "The service has been stopped\n ", Toast.LENGTH_LONG).show();
stopService(new Intent(this,SpeakerService.class));
break;
}
}
protected void onActivityResult(int requestcode,int resultcode,Intent data)
{
if(requestcode == MY_DATA_CHECK_CODE)
{
if(resultcode==TextToSpeech.Engine.CHECK_VOICE_DATA_PASS)
{
// success so create the TTS engine
mtts = new TextToSpeech(this,this);
mtts.setLanguage(Locale.ENGLISH);
}
else
{
//install the Engine
Intent install = new Intent();
install.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
startActivity(install);
}
}
}
public void onDestroy(Bundle savedInstanceStatBundle)
{
mtts.shutdown();
}
//public void onPause()
//{
// super.onPause();
// // if our app has no focus
// if(mtts!=null)
// mtts.stop();
// }
#Override
public void onInit(int status) {
if(status==TextToSpeech.SUCCESS)
button.setEnabled(true);
}
}
RECEIVER CLASS:
package com.example.TextSpeaker;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsMessage; // supports both gsm and cdma
import android.util.Log;
import android.widget.Toast;
public class Receiver extends BroadcastReceiver{
//TextSpeaker tsp=new TextSpeaker();
public String str="";
#Override
public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras();
Log.d("Receiver","Message received successfully");
SmsMessage[] msgs = null;
if(bundle!=null)
{
// retrive the sms received
Object[] pdus = (Object[])bundle.get("pdus");
msgs = new SmsMessage[pdus.length];
for(int i=0;i<msgs.length;i++)
{
msgs[i]=SmsMessage.createFromPdu((byte[]) pdus[i]);
str+="Message From "+msgs[i].getOriginatingAddress()+".";
str+="The message is "+msgs[i].getMessageBody().toString();
}
Toast.makeText(context,str,Toast.LENGTH_SHORT).show();
}
}
}
SERVICESPEAKER CLASS:
package com.example.TextSpeaker;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.speech.tts.TextToSpeech;
import android.util.Log;
import android.widget.Toast;
public class SpeakerService extends Service {
Receiver rv = new Receiver();
TextSpeaker tspker = new TextSpeaker();
//public TextToSpeech mtts;
#Override
public IBinder onBind(Intent arg0) {
// TODO Auto-generated method stub
return null;
}
#Override
public void onCreate(){
//mtts =new TextToSpeech(getBaseContext(), null);
Log.d("SpeakerService","Service created successfully!");
//mtts.speak(rv.str, TextToSpeech.QUEUE_FLUSH,null);
}
#Override
public void onStart(Intent intent,int startid)
{
Log.d("SpeakerService","Service started successfully!");
tspker.mtts.speak(rv.str, TextToSpeech.QUEUE_FLUSH,null);
}
#Override
public void onDestroy(){
if(tspker.mtts!=null)
{
tspker.mtts.stop();
Toast.makeText(getApplicationContext(),"The service has been destroyed!", Toast.LENGTH_SHORT).show();
}
}
}
looks like tspker.mtts is NULL.
add some logging in SpeakerService.onStart, to check that, or other NULL cases:
public void onStart(Intent intent,int startid)
{
Log.d("SpeakerService","Service started successfully!");
Log.d("SpeakerService","rv = " + rv.toString());
Log.d("SpeakerService","tspker = " + tspker.toString());
Log.d("SpeakerService","tspker.mtts = " + tspker.mtts.toString());
tspker.mtts.speak(rv.str, TextToSpeech.QUEUE_FLUSH,null);
}