I am trying to parse a *123#
in my code but anytime I run the program the #
never seems to appear:
protected void makeCall(){
Log.i("make call", "");
Intent phoneIntent = new Intent(Intent.ACTION_CALL);
phoneIntent.setData(Uri.parse("tel: *123#"));
try{
startActivity(phoneIntent);
finish();
Log.i("finish making call...", "");
}catch (android.content.ActivityNotFoundException ex){
Toast.makeText(MainActivity.this,"call failed",Toast.LENGTH_LONG).show();
}
}
Please help me out with this.
protected void makeCall(){
Log.i("make call", "");
Intent phoneIntent = new Intent(Intent.ACTION_CALL);
phoneIntent.setData(Uri.parse("tel:*123#"));
try{
startActivity(phoneIntent);
// finish();
Log.i("finish making call...", "");
}catch (android.content.ActivityNotFoundException ex){
Toast.makeText(MainActivity.this,"call failed",Toast.LENGTH_LONG).show();
}
}
Must add <uses-permission android:name="android.permission.CALL_PHONE" />
in Manifest as well.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.