`字符串stateStr = intent.getExtras()。getString(TelephonyManager.EXTRA_STATE); 数字= intent.getExtras()。getString(TelephonyManager.EXTRA_INCOMING_NUMBER); 如果(intent.getAction()。equals(Intent.ACTION_NEW_OUTGOING_CALL)){ 数字= intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER).toString();
}
if (number != null) {
number = number.trim();
number = number.replace("+91", "");
}
DbAutoSave clientDataBase = new DbAutoSave(context);
TelephonyManager tm = (TelephonyManager) context.getSystemService(Service.TELEPHONY_SERVICE);
operator_name = tm.getNetworkOperatorName();
if (stateStr != null) {
if (stateStr.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
state = TelephonyManager.CALL_STATE_RINGING;
isExist = clientDataBase.isNumberExists2(number);
if (isExist == true) {
DatabaseRegistration clientDataBase1 = new DatabaseRegistration(context);
RegistrationSetterGetter setterGetter = new RegistrationSetterGetter();
setterGetter = clientDataBase1.getDataOfSingleClient2(number);
USERname = setterGetter.getName();
String username=USERname;
INDUStype = setterGetter.getIndusrtyName();
String Industryname=setterGetter.getIndusrtyName();
ORGname = setterGetter.getCompanyName();
String companynam=setterGetter.getCompanyName();
Log.d("RESPONSE",USERname+" "+INDUStype+" "+ORGname);
opendialogg(operator_name, number, USERname, INDUStype, ORGname);
} else {
progressBar = new ProgressBar(context);
getNumberDeatilsOperation(number, operator_name);
}
} else if (stateStr.equals(TelephonyManager.EXTRA_STATE_IDLE)) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
sendToHost();
}
}, 3000);
} else if (stateStr.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) {
getInitial();
context.startService(new Intent(context, MyRecordingService.class).putExtra("initcall", datess));
}
} else if (stateStr == null) {
DatabaseRegistration dbAutoSave = new DatabaseRegistration(context);
// RegistrationSetterGetter registrationSetterGetter=new RegistrationSetterGetter();
isExist = dbAutoSave.isNumberExists2(number);
if (isExist == true) {
// DbAutoSave clientDataBase1 = new DbAutoSave(context);
RegistrationSetterGetter setterGetter = new RegistrationSetterGetter();
setterGetter = dbAutoSave.getDataOfSingleClient2(number);s
USERname = setterGetter.getName();
INDUStype = setterGetter.getIndusrtyName();
ORGname = setterGetter.getCompanyName();
System.out.print("VALUE OF EXISTING DATA PHASE");
Log.d("RESPONSE",USERname+" "+INDUStype+" "+ORGname);
opendialogg(operator_name, number, USERname, INDUStype, ORGname);
} else {
progressBar = new ProgressBar(context);
getNumberDeatilsOperation(number, operator_name);
}
}
}`
`