Example usage for android.telephony PhoneStateListener LISTEN_CALL_STATE

List of usage examples for android.telephony PhoneStateListener LISTEN_CALL_STATE

Introduction

In this page you can find the example usage for android.telephony PhoneStateListener LISTEN_CALL_STATE.

Prototype

int LISTEN_CALL_STATE

To view the source code for android.telephony PhoneStateListener LISTEN_CALL_STATE.

Click Source Link

Document

Listen for changes to the device call state.

Usage

From source file:com.glanznig.beepme.BeeperApp.java

@Override
public void onCreate() {
    super.onCreate();
    getPreferences();/*  w w  w .  ja va  2s. c o  m*/
    setTimerProfile();

    onAppUpdate(getPreferences().getAppVersion());

    // save thumbnail sizes
    DisplayMetrics metrics = this.getResources().getDisplayMetrics();
    int screenDpWidth = (int) (metrics.widthPixels / metrics.density + 0.5f);
    int[] sizes = { 48, 64, screenDpWidth };
    getPreferences().setThumbnailSizes(sizes);

    // listen to call events
    if (callStateListener == null) {
        callStateListener = new CallStateListener(BeeperApp.this);
    }
    TelephonyManager telManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
    telManager.listen(callStateListener, PhoneStateListener.LISTEN_CALL_STATE);

    //set export running to false
    getPreferences().setExportRunningSince(0L);

    UptimeTable uptimeTbl = new UptimeTable(this.getApplicationContext(), timerProfile);

    if (isBeeperActive()) {
        long scheduledBeepId = getPreferences().getScheduledBeepId();
        //is there a scheduled beep, if no, create one, if yes and it is expired, create a new one
        if (scheduledBeepId != 0L) {
            ScheduledBeepTable sbt = new ScheduledBeepTable(this.getApplicationContext());
            if (sbt.getStatus(scheduledBeepId) != 3 && sbt.isExpired(scheduledBeepId)) {
                expireTimer();
                setTimer();
            }
        } else {
            setTimer();
        }

        //is there a notification, if no, create one
        //cannot check if there is a notification or not, so call create, it will be replaced
        createNotification();

        //is there a open uptime interval, if no, create one
        long uptimeId = getPreferences().getUptimeId();
        if (uptimeId == 0L) {
            getPreferences().setUptimeId(uptimeTbl.startUptime(Calendar.getInstance().getTime()));
        }
    } else {
        long scheduledBeepId = getPreferences().getScheduledBeepId();
        //is there a scheduled beep, if yes, cancel it
        if (scheduledBeepId != 0L) {
            cancelTimer();
        }

        //cancel notifications
        NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        manager.cancel(TAG, NOTIFICATION_ID);
        manager.cancel(TAG, ExportActivity.EXPORT_RUNNING_NOTIFICATION);

        //is there a open uptime interval, if yes, end it
        long uptimeId = getPreferences().getUptimeId();

        if (uptimeId != 0L) {
            uptimeTbl.endUptime(uptimeId, Calendar.getInstance().getTime());
            getPreferences().setUptimeId(0L);
        }
    }
}

From source file:jp.morihirosoft.twwb.TwwbService.java

private void registerReceivers() {
    if (DEBUG)/*w w  w  .j a va 2  s .c o m*/
        Log.d(TAG, "registerReceivers");
    if (!mIsRegistered) {
        mIsRegistered = true;
        registerReceiver(mReceiverScreenOn, new IntentFilter(Intent.ACTION_SCREEN_ON));
        registerReceiver(mReceiverScreenOff, new IntentFilter(Intent.ACTION_SCREEN_OFF));
        TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
        LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
        lbm.registerReceiver(mReceiverRecognition, new IntentFilter(Constants.ACTION_RECOGNITION));
    }
}

From source file:com.marvin.rocklock.RockLockActivity.java

/** Called when the activity is first created. */
@Override//from w  w  w.ja v  a2 s  . c  o  m
public void onCreate(Bundle savedInstanceState) {

    mSelf = this;

    sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
            Uri.parse("file://" + Environment.getExternalStorageDirectory())));

    mPlayer = new RockLockMusicPlayer(this);

    super.onCreate(savedInstanceState);

    requestWindowFeature(android.view.Window.FEATURE_NO_TITLE);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);

    setContentView(R.layout.main);
    mIconDisplay = (ImageView) findViewById(R.id.gestureIcon);
    mCurrentTrack = (TextView) findViewById(R.id.current_track);
    mCurrentInfo = (TextView) findViewById(R.id.current_info);
    mUpcomingText = (TextView) findViewById(R.id.upcoming);
    mModeText = (TextView) findViewById(R.id.mode_text);

    mGestureOverlay = (MusicGestureOverlay) findViewById(R.id.gestureLayer);
    mGestureOverlay.setGestureListener(new PlayerGestureListener(), true);
    updateDisplayText(null, null, false);

    mTts = new TextToSpeech(this, new TextToSpeech.OnInitListener() {

        @Override
        public void onInit(int status) {
            mTts.setOnUtteranceCompletedListener(new OnUtteranceCompletedListener() {
                @Override
                public void onUtteranceCompleted(String utteranceId) {
                    if (mCurrentUtteranceId != null && mCurrentUtteranceId.equals(utteranceId)) {
                        mPlayer.restoreMusic();
                    }
                }
            });
        }
    });
    mTts.addEarcon(TOCK_EARCON, RockLockActivity.class.getPackage().getName(), R.raw.tock_snd);
    mTts.addEarcon(TICK_EARCON, RockLockActivity.class.getPackage().getName(), R.raw.tick_snd);

    mVibe = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
    mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

    mWasStartedByService = getIntent().getBooleanExtra(EXTRA_STARTED_BY_SERVICE, false);

    mPhoneListener = new RockLockPhoneListener();
    final TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
    tm.listen(mPhoneListener, PhoneStateListener.LISTEN_CALL_STATE);
    mPausedForCall = false;

    // Start the service in case it is not already running
    startService(new Intent(this, ScreenOnHandlerService.class));

    // Get notification manager
    mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    loadBookmarks();

    // Browsing preference
    mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    mBrowsingPref = mPrefs.getBoolean(getString(R.string.browse_mode), true);
}

From source file:org.metawatch.manager.Monitors.java

public static void start(Context context, TelephonyManager telephonyManager) {
    // start weather updater

    if (Preferences.logging)
        Log.d(MetaWatch.TAG, "Monitors.start()");

    createBatteryLevelReciever(context);
    createWifiReceiver(context);/*from  w  ww.ja va  2  s  . co  m*/

    if (Preferences.weatherGeolocation) {
        if (Preferences.logging)
            Log.d(MetaWatch.TAG, "Initialising Geolocation");

        try {
            locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
            locationProvider = LocationManager.NETWORK_PROVIDER;

            networkLocationListener = new NetworkLocationListener(context);

            locationManager.requestLocationUpdates(locationProvider, 30 * 60 * 1000, 500,
                    networkLocationListener);

            RefreshLocation();
        } catch (IllegalArgumentException e) {
            if (Preferences.logging)
                Log.d(MetaWatch.TAG, "Failed to initialise Geolocation " + e.getMessage());
        }
    } else {
        if (Preferences.logging)
            Log.d(MetaWatch.TAG, "Geolocation disabled");
    }

    CallStateListener phoneListener = new CallStateListener(context);

    telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    int phoneEvents = PhoneStateListener.LISTEN_CALL_STATE | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
            | PhoneStateListener.LISTEN_DATA_CONNECTION_STATE;
    telephonyManager.listen(phoneListener, phoneEvents);

    if (Utils.isGmailAccessSupported(context)) {
        gmailMonitor = new GmailMonitor(context);
        gmailMonitor.startMonitor();
    }

    try {
        contentObserverMessages = new ContentObserverMessages(context);
        Uri uri = Uri.parse("content://mms-sms/conversations/");
        contentResolverMessages = context.getContentResolver();
        contentResolverMessages.registerContentObserver(uri, true, contentObserverMessages);
    } catch (Exception x) {
    }

    try {
        contentObserverCalls = new ContentObserverCalls(context);
        //Uri uri = Uri.parse("content://mms-sms/conversations/");
        contentResolverCalls = context.getContentResolver();
        contentResolverCalls.registerContentObserver(android.provider.CallLog.Calls.CONTENT_URI, true,
                contentObserverCalls);
    } catch (Exception x) {
    }

    try {
        contentObserverAppointments = new ContentObserverAppointments(context);
        Uri uri = Uri.parse("content://com.android.calendar/calendars/");
        contentResolverAppointments = context.getContentResolver();
        contentResolverAppointments.registerContentObserver(uri, true, contentObserverAppointments);
    } catch (Exception x) {
    }

    // temporary one time update
    updateWeatherData(context);

    startAlarmTicker(context);
}

From source file:org.chirpradio.mobile.PlaybackService.java

private void setupTelephonyHooks() {
    TelephonyManager telephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);

    phoneStateListener = new PhoneStateListener() {

        @Override//from   w  w  w .  ja  v a2s  . co  m
        public void onCallStateChanged(int state, String incomingNumber) {
            switch (state) {
            case TelephonyManager.CALL_STATE_OFFHOOK:
            case TelephonyManager.CALL_STATE_RINGING:
                if (isPlaying) {
                    Debug.log(this, "call began, stopping...");
                    stop();
                    isInCall = true;
                }
                break;
            case TelephonyManager.CALL_STATE_IDLE:
                if (isInCall) {
                    isInCall = false;
                    Debug.log(this, "call ended; resuming...");
                    start();
                }
                break;
            }
        }
    };

    telephonyManager.listen(phoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
}

From source file:com.findcab.activity.LocationOverlay.java

private void iniView() {

    manager = (TelephonyManager) this.getSystemService(TELEPHONY_SERVICE);

    manager.listen(new PhoneCallListener(), PhoneStateListener.LISTEN_CALL_STATE);

    System.out.println("?locationOverlay-------------------------->");

    // id//ww  w.ja  va2  s.c  om
    SharedPreferences sharedata = getSharedPreferences("data", 0);
    psID = sharedata.getInt("psID", 0);
    isWaiting = false;

    if (!HttpTools.isNetworkAvailable(context)) {
        //         Toast.makeText(context, "", Toast.LENGTH_SHORT).show();
        MyToast toast = new MyToast(context, "");
        toast.startMyToast();
    }

    mMapView = (MapView) findViewById(R.id.bmapView);

    /**
     * callingTitle
     */
    callingTitle = (RelativeLayout) findViewById(R.id.map_calling_title);
    locate = (Button) findViewById(R.id.map_calling_title_btn_fresh);
    locate.setOnClickListener(this);
    setting = (Button) findViewById(R.id.map_calling_title_btn_setting);
    setting.setOnClickListener(this);
    title = (TextView) findViewById(R.id.map_calling_title_txt);

    /**
     * waitingTitle
     */
    waitingTitle = (RelativeLayout) findViewById(R.id.map_waiting_title);
    cab_count = (TextView) findViewById(R.id.map_waiting_title_txt_cab_count);
    waittingTimeEdit = (TextView) findViewById(R.id.map_waiting_title_waitintTxt);
    /**
     * answerTitle
     */
    answerTitle = (RelativeLayout) findViewById(R.id.map_answer_title);
    answerTitleName = (TextView) findViewById(R.id.map_driver_head_text);
    answerTitleInfo = (TextView) findViewById(R.id.map_driver_air_text);
    answerTitleDistance = (TextView) findViewById(R.id.map_driver_distance_text);
    answerTitlTime = (TextView) findViewById(R.id.map_driver_time_text);
    answerCallDriver = (Button) findViewById(R.id.map_driver_call_button);
    answerCallDriver.setOnClickListener(this);
    /**
     * callingBottom
     */
    callingBottom = (LinearLayout) findViewById(R.id.map_calling_bottom);
    call = (Button) findViewById(R.id.map_calling_bottom_btn_call);
    call.setOnClickListener(this);
    /**
     * waitingBottom
     */
    waitingBottom = (LinearLayout) findViewById(R.id.map_waiting_bottom);
    waitingCancle = (Button) findViewById(R.id.map_waiting_bottom_btn_cancel);
    waitingCancle.setOnClickListener(this);

    /**
     * answerBottom
     */
    answerBottom = (LinearLayout) findViewById(R.id.map_answer_bottom);
    answerCancle = (Button) findViewById(R.id.map_answr_bottom_btn_cancel);
    answerCancle.setOnClickListener(this);

    androidDevice = Tools.getDeviceId(context);
    /**
     * dialog
     */
    timeOutDialog = (RelativeLayout) findViewById(R.id.map_dialog_timeout);
    timeOutDialogBtnCancel = (Button) findViewById(R.id.dialog_frist_cancel);
    timeOutDialogBtnCancel.setOnClickListener(this);
    timeOutDialogBtnContiune = (Button) findViewById(R.id.dialog_frist_contiune);
    timeOutDialogBtnContiune.setOnClickListener(this);

    dialog1 = (RelativeLayout) findViewById(R.id.map_dialog1);
    dialog1BtnCancle = (Button) findViewById(R.id.dialog_two_cancel);
    dialog1BtnCancle.setOnClickListener(this);
    dialog1BtnContiune = (Button) findViewById(R.id.dialog_two_contiune);
    dialog1BtnContiune.setOnClickListener(this);

    dialog2 = (RelativeLayout) findViewById(R.id.map_dialog2);
    dialog2Btn1 = (Button) findViewById(R.id.dialog_three_1);
    dialog2Btn1.setOnClickListener(this);
    dialog2Btn2 = (Button) findViewById(R.id.dialog_three_2);
    dialog2Btn2.setOnClickListener(this);
    dialog2Btn3 = (Button) findViewById(R.id.dialog_three_3);
    dialog2Btn3.setOnClickListener(this);
    dialog2Btn4 = (Button) findViewById(R.id.dialog_three_4);
    dialog2Btn4.setOnClickListener(this);

    mPopView = super.getLayoutInflater().inflate(R.layout.popview_title, null);
    mMapView.addView(mPopView, new MapView.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,
            null, MapView.LayoutParams.TOP_LEFT));
    mPopView.setVisibility(View.GONE);

    // ?
    iZoom = mMapView.getZoomLevel();

    // mapview???
    // return boolean
    mMapView.setDoubleClickZooming(false);

    mMapView.setClickable(false);

    // MapController?
    mapController = mMapView.getController();

    //  ?[3,18]
    mapController.setZoom(15);

    mLocClient = new LocationClient(this);

    LocationClientOption option = new LocationClientOption();
    option.setOpenGps(true);// gps
    option.setCoorType("bd09ll"); // ??
    mLocClient.setLocOption(option);
    mLocClient.registerLocationListener(this);// ?BDLocationListener?
    mLocClient.start();

}

From source file:com.andryr.musicplayer.PlaybackService.java

private void initTelephony() {
    if (mAutoPause) {
        mTelephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
        if (mTelephonyManager != null) {
            mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
        }//from w ww  .jav a 2  s  . c o m
    }
}

From source file:org.mythtv.client.ui.MainMenuFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mLocationProfile = mLocationProfileDaoHelper.findConnectedProfile(getActivity());

    adapter = new FrontendAdapter(getActivity(), R.layout.frontend_row, MainMenuFragment.GetFrontends());

    sTelManager = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
    sTelManager.listen(new PhoneStateListener() {

        /* (non-Javadoc)
         * @see android.telephony.PhoneStateListener#onCallStateChanged(int, java.lang.String)
         *///w w  w . j  ava2 s  . co  m
        @Override
        public void onCallStateChanged(int state, String incomingNumber) {

            if (state == TelephonyManager.CALL_STATE_RINGING) {

                final Frontend fe = selectedFrontend;

                if (null == fe)
                    return;

                SendMessageTask sendMessageTask = new SendMessageTask(getActivity(), mLocationProfile);
                sendMessageTask.execute(fe.getUrl(), "Incoming Call From: " + incomingNumber);
            }

            super.onCallStateChanged(state, incomingNumber);
        }
    }, PhoneStateListener.LISTEN_CALL_STATE);
}

From source file:net.sf.asap.PlayerService.java

@Override
public void onStart(Intent intent, int startId) {
    super.onStart(intent, startId);

    registerReceiver(headsetReceiver, new IntentFilter(Intent.ACTION_HEADSET_PLUG));
    registerMediaButtonEventReceiver("registerMediaButtonEventReceiver");

    TelephonyManager telephony = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
    telephony.listen(new PhoneStateListener() {
        public void onCallStateChanged(int state, String incomingNumber) {
            if (state == TelephonyManager.CALL_STATE_RINGING)
                pause();//  w ww  .ja v a 2s.  co m
        }
    }, PhoneStateListener.LISTEN_CALL_STATE);

    Uri uri = intent.getData();
    String playlistUri = intent.getStringExtra(EXTRA_PLAYLIST);
    if (playlistUri != null)
        setPlaylist(Uri.parse(playlistUri), false);
    else if ("file".equals(uri.getScheme())) {
        if (ASAPInfo.isOurFile(uri.toString()))
            setPlaylist(Util.getParent(uri), false);
        else {
            setPlaylist(uri, true);
            uri = playlist.get(0);
        }
    }
    playFile(uri, SONG_DEFAULT);
}

From source file:com.nbplus.vbroadlauncher.RealtimeBroadcastActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
    acquireCpuWakeLock();//  w  w w.  j  av a  2 s. com

    KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
    km.inKeyguardRestrictedInputMode();
    if (km.inKeyguardRestrictedInputMode()) {
        Log.i(TAG, " ??");
        isKeyguardRestrictedInputMode = true;
    } else {
        Log.i(TAG, "   ??");
    }

    mLastNetworkStatus = NetworkUtils.isConnected(this);
    Intent intent = getIntent();
    if (intent == null || !PushConstants.ACTION_PUSH_MESSAGE_RECEIVED.equals(intent.getAction())) {
        Log.d(TAG, "empty or none broadcast intent value ...");
        finishActivity();
        return;
    }

    mBroadcastData = intent.getParcelableExtra(Constants.EXTRA_BROADCAST_PAYLOAD_DATA);
    if (mBroadcastData == null) {
        Log.d(TAG, ">> payload data is null");
        finishActivity();
        return;
    }

    mBroadcastPayloadIdx = intent.getLongExtra(Constants.EXTRA_BROADCAST_PAYLOAD_INDEX, -1);
    Log.d(TAG, ">> onCreate() mBroadcastPayloadIdx= " + mBroadcastPayloadIdx);

    // ? ms  ? ?? ? ?   ?  ????
    // broadcast ? .
    //  ?? ?? ??.
    Intent i = new Intent(this, RealtimeBroadcastActivity.class);
    i.setAction(intent.getAction());
    i.putExtra(Constants.EXTRA_BROADCAST_PAYLOAD_DATA, mBroadcastData);
    i.putExtra(Constants.EXTRA_BROADCAST_PAYLOAD_INDEX, mBroadcastPayloadIdx);
    LocalBroadcastManager.getInstance(this).sendBroadcast(i);

    IntentFilter filter = new IntentFilter();
    filter.addAction(PushConstants.ACTION_PUSH_MESSAGE_RECEIVED);
    filter.addAction(Constants.ACTION_BROWSER_ACTIVITY_CLOSE);
    LocalBroadcastManager.getInstance(this).registerReceiver(mBroadcastReceiver, filter);

    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
    registerReceiver(mBroadcastReceiver, intentFilter);

    hideSystemUI();
    /*
    final Window win = getWindow();
    win.setFlags(
        WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
                | WindowManager.LayoutParams.FLAG_FULLSCREEN
                | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
                | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD,
        WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
                | WindowManager.LayoutParams.FLAG_FULLSCREEN
                | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
                | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
            
    win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
                | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
                | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
                | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
                | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON);
    */

    if (Constants.PUSH_PAYLOAD_TYPE_TEXT_BROADCAST.equals(mBroadcastData.getServiceType())) {
        setContentView(R.layout.fragment_text_broadcast);
    } else {
        setContentView(R.layout.fragment_audio_broadcast);
    }
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
            | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);

    if (Constants.PUSH_PAYLOAD_TYPE_TEXT_BROADCAST.equals(mBroadcastData.getServiceType())) {
        mcheckText2SpeechLister = this;
        // ?
        mTextView = (TextView) findViewById(R.id.broadcast_text);
        mTextView.setText(mBroadcastData.getMessage());
        mTextView.setVerticalScrollBarEnabled(true);
        mTextView.setHorizontalScrollBarEnabled(false);
        mTextView.setMovementMethod(new ScrollingMovementMethod());

        mHandler.sendEmptyMessageDelayed(HANDLER_MESSAGE_SETUP_CURRENT_PLAYING, 800);
        Log.d(TAG, "text broadcast = " + mBroadcastData.getMessage());

        mText2SpeechHandler = new TextToSpeechHandler(this, this);
        checkText2SpeechAvailable();
        mIsTTS = true;
    } else {
        // , ??
        mWebView = (WebView) findViewById(R.id.webview);
        mWebViewClient = new RealtimeBroadcastWebViewClient(this, mWebView, this);
        mWebViewClient.setBackgroundTransparent();

        String url = mBroadcastData.getMessage();
        if (url.indexOf("?") > 0) {
            if (!url.contains("UUID=")) {
                url += ("&UUID=" + LauncherSettings.getInstance(this).getDeviceID());
            }
            if (!url.contains("APPID=")) {
                url += ("&APPID=" + getApplicationContext().getPackageName());
            }
        } else {
            if (!url.contains("UUID=")) {
                url += ("?UUID=" + LauncherSettings.getInstance(this).getDeviceID());
            }
            if (!url.contains("APPID=")) {
                if (!url.contains("UUID=")) {
                    url += ("?APPID=" + getApplicationContext().getPackageName());
                } else {
                    url += ("&APPID=" + getApplicationContext().getPackageName());
                }
            }
        }

        mWebViewClient.loadUrl(url);
        mIsTTS = false;
    }
    AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
    mStreamMusicVolume = audio.getStreamVolume(AudioManager.STREAM_MUSIC);
    audio.setStreamVolume(AudioManager.STREAM_MUSIC, audio.getStreamMaxVolume(AudioManager.STREAM_MUSIC),
            AudioManager.FLAG_PLAY_SOUND);

    if (Constants.OPEN_BETA_PHONE && LauncherSettings.getInstance(this).isSmartPhone()) {
        StateListener phoneStateListener = new StateListener();
        TelephonyManager telephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
        telephonyManager.listen(phoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
    }
}