Hi.
I'm developing an application that helps getting an connection with
busy phoners. My application should try to call a number and if
the number is busy it repeats after 30 seconds till the number is
accessible.
The problem is, that i don't get a callState like "number is busy".
i don't know the right way to see when the callState is ringing on the
other side
and when the other side is busy.
My idea was the following:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TelephonyManager manager = (TelephonyManager)
getSystemService(Context.TELEPHONY_SERVICE);
manager.listen( new PhoneStateListener(){
public void onCallStateChanged(int state, String incomingNumber) {
super.onCallStateChanged(state, incomingNumber);
while(state == 0) { //CallState = 0 // Device call state: No
activity
try {
Intent callIntent = new Intent (Intent.ACTION_CALL,
phoneNumber);
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(callIntent);
Thread.sleep(30000);
}
catch(Exception e) {
e.printStackTrace();;
}
}
}
}, PhoneStateListener.LISTEN_CALL_STATE);
}
Hope someone can help me.
Thanks,
Mak
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---