File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
app/src/main/java/com/bald/uriah/baldphone/activities Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,11 @@ public class DialerActivity extends BaldActivity {
73
73
public static void call (final CharSequence number , final Context context ) {
74
74
if (ActivityCompat .checkSelfPermission (context , Manifest .permission .CALL_PHONE ) == PackageManager .PERMISSION_GRANTED ) {
75
75
try {
76
- context .startActivity (new Intent (Intent .ACTION_CALL ).setData (Uri .parse ("tel:" + number )));
76
+ final CharSequence finalNumber = // In order to handle USSD
77
+ (number .charAt (number .length () - 1 ) == '#' ) ?
78
+ number .subSequence (0 , number .length () - 1 ) + Uri .encode ("#" ) : number ;
79
+
80
+ context .startActivity (new Intent (Intent .ACTION_CALL ).setData (Uri .parse ("tel:" + finalNumber )));
77
81
} catch (SecurityException e ) {
78
82
Log .e (TAG , e .getMessage ());
79
83
e .printStackTrace ();
You can’t perform that action at this time.
0 commit comments