1

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.

Community
  • 1
  • 1
crazyCoder
  • 55
  • 1
  • 8

1 Answers1

0

I was faced with the same question and the solution was to send the option with the first call. in your case

call(encodedStar+"XXXX" +encodedStar+'1'+ encodedHash);

I hope this will help someone.

Kaleab O.
  • 11
  • 3