List of usage examples for android.telephony PhoneStateListener LISTEN_NONE
int LISTEN_NONE
To view the source code for android.telephony PhoneStateListener LISTEN_NONE.
Click Source Link
From source file:com.jtxdriggers.android.ventriloid.VentriloidService.java
@Override public void onDestroy() { running = false;//from w ww . j a v a 2s . co m connected = false; if (tm != null) tm.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE); try { unregisterReceiver(bluetoothReceiver); } catch (IllegalArgumentException e) { } unregisterReceiver(activityReceiver); VentriloInterface.logout(); wifiLock.release(); wakeLock.release(); nm.cancelAll(); }
From source file:com.wirelessmoves.cl.MainActivity.java
@Override protected void onPause() { super.onPause(); /* remove the listener object from the telephony manager as otherwise several listeners * will appear on some Android implementations once the application is resumed. *//* w w w . j a va 2s .c om*/ Tel.listen(MyListener, PhoneStateListener.LISTEN_NONE); isListenerActive = false; /* stop receiving GPS information */ locationManager.removeUpdates(gpsListener); /* let the device activate the screen lock again */ wl.release(); }
From source file:com.example.android.phonecallingsample.MainActivity.java
@Override protected void onDestroy() { super.onDestroy(); if (isTelephonyEnabled()) { mTelephonyManager.listen(mListener, PhoneStateListener.LISTEN_NONE); }//from ww w .ja v a 2s .c o m }
From source file:com.secupwn.aimsicd.service.CellTracker.java
/** * Description: Cell Information Tracking and database logging * * TODO: update this!!//from w ww .java 2s. com * * If the "tracking" option is enabled (as it is by default) then we are keeping * a record (tracking) of the device location "gpsd_lat/lon", the connection * signal strength (rx_signal) and data activity (?) and data connection state (?). * * The items included in these are stored in the "DBi_measure" table. * * DATA_ACTIVITY: * DATA_CONNECTION_STATE: * * * UI/function: Drawer: "Toggle Cell Tracking" * * Issues: * * Notes: TODO: We also need to listen and log for: * * [ ] LISTEN_CALL_STATE: * CALL_STATE_IDLE * CALL_STATE_OFFHOOK * CALL_STATE_RINGING * * [ ] LISTEN_SERVICE_STATE: * STATE_EMERGENCY_ONLY * STATE_IN_SERVICE * STATE_OUT_OF_SERVICE * STATE_POWER_OFF * * @param track Enable/Disable tracking */ public void setCellTracking(boolean track) { if (track) { tm.listen(cellSignalListener, PhoneStateListener.LISTEN_CELL_LOCATION | // gpsd_lat/lon ? PhoneStateListener.LISTEN_SIGNAL_STRENGTHS | // rx_signal PhoneStateListener.LISTEN_DATA_ACTIVITY | // No,In,Ou,IO,Do PhoneStateListener.LISTEN_DATA_CONNECTION_STATE | // Di,Ct,Cd,Su PhoneStateListener.LISTEN_CELL_INFO // !? (Need API 17) ); trackingCell = true; Helpers.msgShort(context, context.getString(R.string.tracking_cell_information)); } else { tm.listen(cellSignalListener, PhoneStateListener.LISTEN_NONE); device.cell.setLon(0.0); device.cell.setLat(0.0); device.setCellInfo("[0,0]|nn|nn|"); //default entries into "locationinfo"::Connection trackingCell = false; Helpers.msgShort(context, context.getString(R.string.stopped_tracking_cell_information)); } setNotification(); }
From source file:com.SecUpwN.AIMSICD.service.AimsicdService.java
@Override public void onDestroy() { super.onDestroy(); prefs.unregisterOnSharedPreferenceChangeListener(this); cancelNotification();//from w w w. ja v a 2 s .c om dbHelper.close(); mContext.unregisterReceiver(mMessageReceiver); if (mTrackingCell) { tm.listen(mCellSignalListener, PhoneStateListener.LISTEN_NONE); lm.removeUpdates(mLocationListener); } //Samsung MultiRil Cleanup if (mRequestExecutor != null) { mRequestExecutor.stop(); mRequestExecutor = null; mHandler = null; mHandlerThread.quit(); mHandlerThread = null; } Log.i(TAG, "Service destroyed"); }
From source file:com.andreadec.musicplayer.MusicService.java
@Override public void onDestroy() { telephonyManager.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE); // Stop listen for telephony events notificationManager.cancel(Constants.NOTIFICATION_MAIN); unregisterReceiver(broadcastReceiver); // Disable broadcast receiver SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean(Constants.PREFERENCE_SHUFFLE, shuffle); editor.putBoolean(Constants.PREFERENCE_REPEAT, repeat); editor.putBoolean(Constants.PREFERENCE_REPEATALL, repeatAll); if (bassBoostAvailable) { editor.putBoolean(Constants.PREFERENCE_BASSBOOST, getBassBoostEnabled()); editor.putInt(Constants.PREFERENCE_BASSBOOSTSTRENGTH, getBassBoostStrength()); } else {/*from w w w . j ava 2 s . c o m*/ editor.remove(Constants.PREFERENCE_BASSBOOST); editor.remove(Constants.PREFERENCE_BASSBOOSTSTRENGTH); } if (equalizerAvailable) { editor.putBoolean(Constants.PREFERENCE_EQUALIZER, getEqualizerEnabled()); editor.putInt(Constants.PREFERENCE_EQUALIZERPRESET, getEqualizerPreset()); } else { editor.remove(Constants.PREFERENCE_EQUALIZER); editor.remove(Constants.PREFERENCE_EQUALIZERPRESET); } editor.putBoolean(Constants.PREFERENCE_SHAKEENABLED, isShakeEnabled()); if (currentPlayingItem != null) { if (currentPlayingItem instanceof BrowserSong) { editor.putString(Constants.PREFERENCE_LASTPLAYINGSONG, currentPlayingItem.getPlayableUri()); editor.putInt(Constants.PREFERENCE_LASTSONGPOSITION, getCurrentPosition()); editor.putLong(Constants.PREFERENCE_LASTPLAYINGSONGFROMPLAYLISTID, -1); } else if (currentPlayingItem instanceof PlaylistSong) { editor.putString(Constants.PREFERENCE_LASTPLAYINGSONG, currentPlayingItem.getPlayableUri()); editor.putInt(Constants.PREFERENCE_LASTSONGPOSITION, getCurrentPosition()); editor.putLong(Constants.PREFERENCE_LASTPLAYINGSONGFROMPLAYLISTID, ((PlaylistSong) currentPlayingItem).getId()); } else { editor.putString(Constants.PREFERENCE_LASTPLAYINGSONG, null); editor.putLong(Constants.PREFERENCE_LASTPLAYINGSONGFROMPLAYLISTID, -1); } } else { editor.putString(Constants.PREFERENCE_LASTPLAYINGSONG, null); editor.putLong(Constants.PREFERENCE_LASTPLAYINGSONGFROMPLAYLISTID, -1); } editor.putString(Constants.PREFERENCE_LASTDIRECTORY, ((MusicPlayerApplication) getApplication()).getCurrentDirectory().getDirectory().getAbsolutePath()); editor.commit(); if (Build.VERSION.SDK_INT >= 14) audioManager.unregisterRemoteControlClient(remoteControlClient); audioManager.unregisterMediaButtonEventReceiver(mediaButtonReceiverComponent); audioManager.abandonAudioFocus(null); shakeListener.disable(); mediaPlayer.release(); stopForeground(true); wakeLockRelease(); // Just to be sure the wakelock has been released! ;-) }
From source file:co.codecrunch.musicplayerlite.manager.MusicPlayerService.java
@SuppressLint("NewApi") @Override// www.j a va 2s . c o m public void onDestroy() { super.onDestroy(); if (remoteControlClient != null) { RemoteControlClient.MetadataEditor metadataEditor = remoteControlClient.editMetadata(true); metadataEditor.clear(); metadataEditor.apply(); audioManager.unregisterRemoteControlClient(remoteControlClient); audioManager.abandonAudioFocus(this); } try { TelephonyManager mgr = (TelephonyManager) getSystemService(TELEPHONY_SERVICE); if (mgr != null) { mgr.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE); } } catch (Exception e) { Log.e("tmessages", e.toString()); } NotificationManager.getInstance().removeObserver(this, NotificationManager.audioProgressDidChanged); NotificationManager.getInstance().removeObserver(this, NotificationManager.audioPlayStateChanged); }
From source file:org.telegram.android.MusicPlayerService.java
@SuppressLint("NewApi") @Override// w ww .ja v a2 s .c om public void onDestroy() { super.onDestroy(); if (remoteControlClient != null) { RemoteControlClient.MetadataEditor metadataEditor = remoteControlClient.editMetadata(true); metadataEditor.clear(); metadataEditor.apply(); audioManager.unregisterRemoteControlClient(remoteControlClient); } try { TelephonyManager mgr = (TelephonyManager) getSystemService(TELEPHONY_SERVICE); if (mgr != null) { mgr.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE); } } catch (Exception e) { FileLog.e("tmessages", e); } NotificationCenter.getInstance().removeObserver(this, NotificationCenter.audioProgressDidChanged); NotificationCenter.getInstance().removeObserver(this, NotificationCenter.audioPlayStateChanged); }
From source file:com.goftagram.telegram.messenger.MusicPlayerService.java
@SuppressLint("NewApi") @Override/*w w w . j av a 2s. c o m*/ public void onDestroy() { super.onDestroy(); if (remoteControlClient != null) { RemoteControlClient.MetadataEditor metadataEditor = remoteControlClient.editMetadata(true); metadataEditor.clear(); metadataEditor.apply(); audioManager.unregisterRemoteControlClient(remoteControlClient); audioManager.abandonAudioFocus(this); } try { TelephonyManager mgr = (TelephonyManager) getSystemService(TELEPHONY_SERVICE); if (mgr != null) { mgr.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE); } } catch (Exception e) { FileLog.e("tmessages", e); } NotificationCenter.getInstance().removeObserver(this, NotificationCenter.audioProgressDidChanged); NotificationCenter.getInstance().removeObserver(this, NotificationCenter.audioPlayStateChanged); }
From source file:com.andryr.musicplayer.PlaybackService.java
@Override public void onDestroy() { if (mMediaSession != null) { mMediaSession.release();// ww w. ja v a 2s .co m } unregisterReceiver(mHeadsetStateReceiver); if (mTelephonyManager != null) { mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE); } saveSeekPos(); mAudioManager.abandonAudioFocus(mAudioFocusChangeListener); mMediaPlayer.stop(); Intent i = new Intent(this, AudioEffectsReceiver.class); i.setAction(AudioEffectsReceiver.ACTION_CLOSE_AUDIO_EFFECT_SESSION); sendBroadcast(i); mMediaPlayer.release(); super.onDestroy(); }