List of usage examples for android.net.wifi WifiManager WIFI_MODE_FULL
int WIFI_MODE_FULL
To view the source code for android.net.wifi WifiManager WIFI_MODE_FULL.
Click Source Link
From source file:com.zuluindia.watchpresenter.MonitorVolumeKeyPress.java
private void startMonitoring() { wifiLock = ((WifiManager) getSystemService(Context.WIFI_SERVICE)).createWifiLock(WifiManager.WIFI_MODE_FULL, "WatchPresenterLock"); wifiLock.acquire();//from w ww .j a v a 2s. c om objPlayer.start(); registerReceiver(volumeKeysReceiver, new IntentFilter(ACTION_VOLUME_KEY_PRESS)); Log.d(LOGCAT, "Media Player started!"); if (objPlayer.isLooping() != true) { Log.d(LOGCAT, "Problem in Playing Audio"); } scheduleMaintenance(); }
From source file:com.mplayer_remote.ServicePlayAFile.java
/** * Metoda uruchamiana po przekazaniu do usugi dziedziczcej po <code>IntentService</code> wiadomoci <code>Intent</code>, w tym wypadku zawierajcej nazw i ciek do pliku multimedialnego wybranego przez uytkownika. * @see android.app.IntentService#onHandleIntent(android.content.Intent) *///from w w w . jav a 2s. com @Override protected void onHandleIntent(Intent intent) { Log.v(TAG, "stopExecuteIntents = " + stopExecuteIntents); if (stopExecuteIntents == false) { fileToPlayString = intent.getStringExtra("file_to_play"); Log.v(TAG, "file_to_play przekazane przez intent z FileChoosera: " + fileToPlayString); absolutePathString = intent.getStringExtra("absolute_path"); Log.v(TAG, "absolute_path przekazane przez intent z FileChoosera: " + absolutePathString); showNotyfications(); WifiManager wm = (WifiManager) getSystemService(Context.WIFI_SERVICE); wifiLock = wm.createWifiLock(WifiManager.WIFI_MODE_FULL, "MyWifiLock"); if (!wifiLock.isHeld()) { wifiLock.acquire(); } if (isfifofileExist() == false) { // isfifofileExist() luck for a true fifo while (ConnectToServer.sendCommandAndWaitForExitStatus("mkfifo fifofile") != 0) { ConnectToServer.sendCommand("rm fifofile"); } } Intent intent_start_RemoteControl = new Intent(getApplicationContext(), RemoteControl.class); intent_start_RemoteControl.putExtra("file_to_play", fileToPlayString); intent_start_RemoteControl.putExtra("absolute_path", absolutePathString); intent_start_RemoteControl.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //intent_start_RemoteControl.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); startActivity(intent_start_RemoteControl); ConnectToServer.sendCommandAndSaveOutputToLockedArrayList( "export DISPLAY=:0.0 && mplayer -fs -slave -quiet -input file=fifofile " + "\"" + fileToPlayString + "\"", mplayerOutputArrayList, mplayerOutputArrayListLock, newMplayerOutputCondition); //RemoteControl.RemoteControlActivityObject.finish(); //ConnectToServer.sendCommand("rm fifofile"); } }
From source file:com.bayapps.android.robophish.playback.LocalPlayback.java
public LocalPlayback(Context context, MusicProvider musicProvider) { this.mContext = context; this.mMusicProvider = musicProvider; this.mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); // Create the Wifi lock (this does not acquire the lock, this just creates it) this.mWifiLock = ((WifiManager) context.getSystemService(Context.WIFI_SERVICE)) .createWifiLock(WifiManager.WIFI_MODE_FULL, "uAmp_lock"); this.mState = PlaybackStateCompat.STATE_NONE; }
From source file:com.jtxdriggers.android.ventriloid.VentriloidService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { int id = intent.getExtras().getInt("id"); ServerAdapter db = new ServerAdapter(this); server = db.getServer(id);/*from ww w .ja v a2 s . com*/ items = new ItemData(this); queue.clear(); volumePrefs = getSharedPreferences("VOLUMES" + server.getId(), Context.MODE_PRIVATE); passwordPrefs = getSharedPreferences("PASSWORDS" + server.getId(), Context.MODE_PRIVATE); wakeLock = ((PowerManager) getSystemService(Context.POWER_SERVICE)) .newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "VentriloidWakeLock"); wakeLock.acquire(); wifiLock = ((WifiManager) getSystemService(Context.WIFI_SERVICE)).createWifiLock(WifiManager.WIFI_MODE_FULL, "VentriloidWifiLock"); wifiLock.acquire(); disconnect = true; r = new Runnable() { public void run() { timeout = true; handler.postDelayed(new Runnable() { @Override public void run() { if (timeout) { VentriloInterface.logout(); sendBroadcast(new Intent(Main.SERVICE_RECEIVER).putExtra("type", (short) VentriloEvents.V3_EVENT_LOGIN_FAIL)); Toast.makeText(getApplicationContext(), "Connection timed out.", Toast.LENGTH_SHORT) .show(); reconnectTimer = 10; handler.post(r); } } }, 9500); if (VentriloInterface.login(server.getHostname() + ":" + server.getPort(), server.getUsername(), server.getPassword(), server.getPhonetic())) { new Thread(new Runnable() { public void run() { while (VentriloInterface.recv()) ; } }).start(); } else { handler.post(new Runnable() { @Override public void run() { VentriloEventData data = new VentriloEventData(); VentriloInterface.error(data); sendBroadcast(new Intent(Main.SERVICE_RECEIVER).putExtra("type", (short) VentriloEvents.V3_EVENT_LOGIN_FAIL)); Toast.makeText(getApplicationContext(), bytesToString(data.error.message), Toast.LENGTH_SHORT).show(); } }); } timeout = false; } }; handler.post(r); return Service.START_NOT_STICKY; }
From source file:com.scooter1556.sms.android.activity.VideoPlayerActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_video_player); restService = RESTService.getInstance(); player = new SMSVideoPlayer(); surface = (SurfaceView) findViewById(R.id.video_surface); surface.setOnSystemUiVisibilityChangeListener(onSystemUiVisibilityChanged); surface.setOnTouchListener(new View.OnTouchListener() { @Override// w w w.j av a2s . c o m public boolean onTouch(View view, MotionEvent motionEvent) { togglePlayback(); return false; } }); holder = surface.getHolder(); holder.addCallback(this); videoOverlay = (ImageView) findViewById(R.id.video_overlay); videoOverlay.setImageResource(R.drawable.play_overlay); timeline = (SeekBar) findViewById(R.id.video_controller_timeline); timeline.setOnSeekBarChangeListener(onSeek); formatBuilder = new StringBuilder(); formatter = new Formatter(formatBuilder, Locale.getDefault()); duration = (TextView) findViewById(R.id.video_controller_duration); duration.setText(stringForTime(0)); currentTime = (TextView) findViewById(R.id.video_controller_current_time); currentTime.setText(stringForTime(0)); playButton = (ImageButton) findViewById(R.id.video_controller_play); playButton.setImageResource(R.drawable.ic_play_light); playButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { togglePlayback(); } }); wifiLock = ((WifiManager) getSystemService(Context.WIFI_SERVICE)).createWifiLock(WifiManager.WIFI_MODE_FULL, "sms"); controller = findViewById(R.id.video_controller); }
From source file:com.scooter1556.sms.lib.android.service.AudioPlayerService.java
@Override public void onCreate() { // Create the service super.onCreate(); restService = RESTService.getInstance(); currentListPosition = 0;//from w w w . j a v a 2s . c om mediaElementList = new ArrayList<>(); // Setup media session mediaSessionCallback = new MediaSessionCallback(); mediaSession = new MediaSessionCompat(this, "SMSPlayer"); mediaSession.setFlags( MediaSessionCompat.FLAG_HANDLES_MEDIA_BUTTONS | MediaSessionCompat.FLAG_HANDLES_TRANSPORT_CONTROLS); mediaSession.setCallback(mediaSessionCallback); mediaState = PlaybackStateCompat.STATE_NONE; updatePlaybackState(); audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE); wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "sms"); wifiLock = ((WifiManager) getSystemService(Context.WIFI_SERVICE)).createWifiLock(WifiManager.WIFI_MODE_FULL, "sms"); }
From source file:com.murati.oszk.audiobook.playback.LocalPlayback.java
public LocalPlayback(Context context, MusicProvider musicProvider) { Context applicationContext = context.getApplicationContext(); this.mContext = applicationContext; this.mMusicProvider = musicProvider; this.mAudioManager = (AudioManager) applicationContext.getSystemService(Context.AUDIO_SERVICE); // Create the Wifi lock (this does not acquire the lock, this just creates it) this.mWifiLock = ((WifiManager) applicationContext.getSystemService(Context.WIFI_SERVICE)) .createWifiLock(WifiManager.WIFI_MODE_FULL, "uAmp_lock"); }
From source file:it.evilsocket.dsploit.core.System.java
public static void init(Context context) throws Exception { mContext = context;//w ww .java 2 s . co m try { mStoragePath = getSettings().getString("PREF_SAVE_PATH", Environment.getExternalStorageDirectory().toString()); mSessionName = "dsploit-session-" + java.lang.System.currentTimeMillis(); mUpdateManager = new UpdateManager(mContext); mPlugins = new ArrayList<Plugin>(); mTargets = new Vector<Target>(); mOpenPorts = new SparseIntArray(3); // if we are here, network initialization didn't throw any error, lock wifi WifiManager wifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE); if (mWifiLock == null) mWifiLock = wifiManager.createWifiLock(WifiManager.WIFI_MODE_FULL, "wifiLock"); if (mWifiLock.isHeld() == false) mWifiLock.acquire(); // wake lock if enabled if (getSettings().getBoolean("PREF_WAKE_LOCK", true) == true) { PowerManager powerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); if (mWakeLock == null) mWakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "wakeLock"); if (mWakeLock.isHeld() == false) mWakeLock.acquire(); } // set ports try { HTTP_PROXY_PORT = Integer.parseInt(getSettings().getString("PREF_HTTP_PROXY_PORT", "8080")); HTTP_SERVER_PORT = Integer.parseInt(getSettings().getString("PREF_HTTP_SERVER_PORT", "8081")); HTTPS_REDIR_PORT = Integer.parseInt(getSettings().getString("PREF_HTTPS_REDIRECTOR_PORT", "8082")); } catch (NumberFormatException e) { HTTP_PROXY_PORT = 8080; HTTP_SERVER_PORT = 8081; HTTPS_REDIR_PORT = 8082; } mNmap = new NMap(mContext); mArpSpoof = new ArpSpoof(mContext); mEttercap = new Ettercap(mContext); mIptables = new IPTables(); mHydra = new Hydra(mContext); mTcpdump = new TcpDump(mContext); // initialize network data at the end mNetwork = new Network(mContext); Target network = new Target(mNetwork), gateway = new Target(mNetwork.getGatewayAddress(), mNetwork.getGatewayHardware()), device = new Target(mNetwork.getLocalAddress(), mNetwork.getLocalHardware()); gateway.setAlias(mNetwork.getSSID()); device.setAlias(android.os.Build.MODEL); mTargets.add(network); mTargets.add(gateway); mTargets.add(device); mInitialized = true; } catch (Exception e) { errorLogging(TAG, e); throw e; } }
From source file:ru.kudzmi.rajitaku.radioService.RadioService.java
private void acquireWiFiLock() { if (wifiLock == null) wifiLock = ((WifiManager) getSystemService(Context.WIFI_SERVICE)) .createWifiLock(WifiManager.WIFI_MODE_FULL, "RadioServiceWiFiLock"); wifiLock.acquire();//from w w w .j a va 2 s . com }
From source file:org.csploit.android.core.System.java
public static void init(Context context) throws Exception { mContext = context;/*from www. ja v a2 s .c om*/ try { Logger.debug("initializing System..."); mStoragePath = getSettings().getString("PREF_SAVE_PATH", Environment.getExternalStorageDirectory().toString()); mSessionName = "csploit-session-" + java.lang.System.currentTimeMillis(); mKnownIssues = new KnownIssues(); mPlugins = new ArrayList<>(); mOpenPorts = new SparseIntArray(3); mServices = new HashMap<>(); mPorts = new HashMap<>(); // if we are here, network initialization didn't throw any error, lock wifi WifiManager wifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE); if (mWifiLock == null) mWifiLock = wifiManager.createWifiLock(WifiManager.WIFI_MODE_FULL, "wifiLock"); if (!mWifiLock.isHeld()) mWifiLock.acquire(); // wake lock if enabled if (getSettings().getBoolean("PREF_WAKE_LOCK", true)) { PowerManager powerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); if (mWakeLock == null) mWakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "wakeLock"); if (!mWakeLock.isHeld()) mWakeLock.acquire(); } // set ports try { HTTP_PROXY_PORT = Integer.parseInt(getSettings().getString("PREF_HTTP_PROXY_PORT", "8080")); HTTP_SERVER_PORT = Integer.parseInt(getSettings().getString("PREF_HTTP_SERVER_PORT", "8081")); HTTPS_REDIR_PORT = Integer.parseInt(getSettings().getString("PREF_HTTPS_REDIRECTOR_PORT", "8082")); MSF_RPC_PORT = Integer.parseInt(getSettings().getString("MSF_RPC_PORT", "55553")); } catch (NumberFormatException e) { HTTP_PROXY_PORT = 8080; HTTP_SERVER_PORT = 8081; HTTPS_REDIR_PORT = 8082; MSF_RPC_PORT = 55553; } uncaughtReloadNetworkMapping(); ThreadHelper.getSharedExecutor().execute(new Runnable() { @Override public void run() { preloadServices(); preloadVendors(); } }); } catch (Exception e) { if (!(e instanceof NoRouteToHostException)) errorLogging(e); throw e; } }