List of usage examples for android.telephony PhoneNumberUtils getNumberFromIntent
public static String getNumberFromIntent(Intent intent, Context context)
From source file:org.jitsi.android.gui.call.CallContactActivity.java
/** * Called when the activity is starting. Initializes the corresponding * call interface./* ww w .j av a 2 s . c om*/ * * @param savedInstanceState If the activity is being re-initialized after * previously being shut down then this Bundle contains the data it most * recently supplied in onSaveInstanceState(Bundle). * Note: Otherwise it is null. */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // There's no need to create fragment if the Activity is being restored. if (savedInstanceState == null) { //Create new call contact fragment String phoneNumber = null; Intent intent = getIntent(); if (intent.getDataString() != null) phoneNumber = PhoneNumberUtils.getNumberFromIntent(intent, this); Fragment ccFragment = CallContactFragment.newInstance(phoneNumber); getSupportFragmentManager().beginTransaction().add(android.R.id.content, ccFragment).commit(); } }
From source file:org.xingjitong.LinphoneLauncherActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); share = PreferenceManager.getDefaultSharedPreferences(this); Intent intent = getIntent();/*from w w w . ja v a 2 s . co m*/ if (intent.getData() != null) { String num = PhoneNumberUtils.getNumberFromIntent(intent, this); share.edit().putBoolean(getString(R.string.pref_call_phone_type), true) .putString(getString(R.string.pref_call_phone_num), num).commit(); } boolean start = share.getBoolean(getString(R.string.pref_call_phone_type), false); if (start) { finish(); } // Hack to avoid to draw twice LinphoneActivity on tablets //yyppexception del /* if (getResources().getBoolean(R.bool.isTablet)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } */ setContentView(R.layout.launcher); PushAgent.getInstance(this).onAppStart(); // try { // PushAgent.getInstance(this).addAlias(UserConfig.getInstance().uid,"wecare"); // } catch (e e) { // e.printStackTrace(); // } catch (JSONException e) { // e.printStackTrace(); // } mHandler = new Handler(); if (getResources().getBoolean(R.bool.enable_push_id)) { Compatibility.initPushNotificationService(this); } if (LinphoneService.isReady()) { onServiceReady(); } else { // start linphone as background startService(new Intent(ACTION_MAIN).setClass(this, LinphoneService.class)); mThread = new ServiceWaitThread(); mThread.start(); } }