Skip to content

Commit 09d520c

Browse files
Fixed USSD Bug #54
1 parent 6bf4766 commit 09d520c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/src/main/java/com/bald/uriah/baldphone/activities/DialerActivity.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ public class DialerActivity extends BaldActivity {
7373
public static void call(final CharSequence number, final Context context) {
7474
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.CALL_PHONE) == PackageManager.PERMISSION_GRANTED) {
7575
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)));
7781
} catch (SecurityException e) {
7882
Log.e(TAG, e.getMessage());
7983
e.printStackTrace();

0 commit comments

Comments
 (0)