I am following this link Prevent USSD dialog and read USSD response? to send USSD request to our netwrok provider, read response and prevent USSD dialog.This is my code
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String encodedStar = Uri.encode("*");
String encodedHash = Uri.encode("#");
startService(new Intent(this, USSDService.class));
call(encodedStar+"XXXX" + encodedHash);
}
protected void call(String phoneNumber) {
startActivity(new Intent("android.intent.action.CALL", Uri.parse("tel:" + phoneNumber)));
}
}
It works fine. As a response it gives me another menu to select what to do. there are 4 options like this.
1. A
2. B
3. C
4. D
Now I want to send the my response 1 or 2 to nework provider and get final response. Plese help me. Thanks in advance.