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:nuclei.media.playback.ExoPlayerPlayback.java
public ExoPlayerPlayback(MediaService service) { mService = service;/*w w w. ja v a2 s .c o m*/ mHandler = new Handler(); final Context ctx = service.getApplicationContext(); mAudioManager = (AudioManager) ctx.getSystemService(Context.AUDIO_SERVICE); PowerManager powerManager = (PowerManager) ctx.getSystemService(Context.POWER_SERVICE); WifiManager wifiManager = (WifiManager) ctx.getSystemService(Context.WIFI_SERVICE); // Create the Wifi lock (this does not acquire the lock, this just creates it) mWifiLock = wifiManager.createWifiLock(WifiManager.WIFI_MODE_FULL, "nuclei_media_wifi_lock"); mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "nuclei_media_cpu_lock"); }
From source file:org.simlar.SimlarService.java
@Override public void onCreate() { Log.i(LOGTAG, "started on device: " + Build.DEVICE); FileHelper.init(this); mVibratorThread = new VibratorThread(this.getApplicationContext()); mRingtoneThread = new RingtoneThread(this.getApplicationContext()); mWakeLock = ((PowerManager) this.getSystemService(Context.POWER_SERVICE)) .newWakeLock(PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "SimlarWakeLock"); mWifiLock = ((WifiManager) this.getSystemService(Context.WIFI_SERVICE)) .createWifiLock(WifiManager.WIFI_MODE_FULL, "SimlarWifiLock"); startForeground(NOTIFICATION_ID, createNotification(SimlarStatus.OFFLINE)); mLinphoneThread = new LinphoneThread(this, this); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); registerReceiver(mNetworkChangeReceiver, intentFilter); startKeepAwake();/*from w w w .j ava2 s .com*/ mHandler.post(new Runnable() { @Override public void run() { initializeCredentials(); } }); }
From source file:be.ugent.zeus.hydra.util.audiostream.MusicService.java
@Override public void onCreate() { Log.i(TAG, "debug: Creating service"); // Create the Wifi lock (this does not acquire the lock, this just creates it) mWifiLock = ((WifiManager) getSystemService(Context.WIFI_SERVICE)) .createWifiLock(WifiManager.WIFI_MODE_FULL, "mylock"); mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); mAudioManager = (AudioManager) getSystemService(AUDIO_SERVICE); if (mStartPlayingAfterRetrieve) { tryToGetAudioFocus();// www . j a v a 2s . c om playStream(); } // create the Audio Focus Helper, if the Audio Focus feature is available (SDK 8 or above) if (android.os.Build.VERSION.SDK_INT >= 8) { mAudioFocusHelper = new AudioFocusHelper(getApplicationContext(), this); } else { mAudioFocus = AudioFocus.Focused; // no focus feature, so we always "have" audio focus } mDummyAlbumArt = BitmapFactory.decodeResource(getResources(), R.drawable.urgent_lockart); mMediaButtonReceiverComponent = new ComponentName(this, MusicIntentReceiver.class); }
From source file:com.trogdan.nanospotify.service.MusicService.java
@Override public void onCreate() { Log.i(LOG_TAG, "debug: Creating service"); // Create the Wifi lock (this does not acquire the lock, this just creates it) mWifiLock = ((WifiManager) getSystemService(Context.WIFI_SERVICE)) .createWifiLock(WifiManager.WIFI_MODE_FULL, "mylock"); mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); mAudioManager = (AudioManager) getSystemService(AUDIO_SERVICE); // create the Audio Focus Helper, if the Audio Focus feature is available (SDK 8 or above) if (android.os.Build.VERSION.SDK_INT >= 8) mAudioFocusHelper = new AudioFocusHelper(getApplicationContext(), this); else/*from w w w . j a v a2s . c o m*/ mAudioFocus = AudioFocus.Focused; // no focus feature, so we always "have" audio focus // Create the mBroadcaster to send state back to UI mBroadcaster = LocalBroadcastManager.getInstance(this); PlayerActivity.isServiceLaunched = true; }
From source file:com.xconns.peerdevicenet.core.CoreAPI.java
@TargetApi(5) @Override/*from w w w . ja v a 2 s .c o m*/ public void onCreate() { // TODO Auto-generated method stub super.onCreate(); Log.d(TAG, "RouterService onCreate()"); timer = new ScheduledThreadPoolExecutor(1); linkMgr = new TransportManager(this, linkHandler); linkMgr.onResume(); mMyDeviceInfo = new DeviceInfo(); //loc wifi myWifiLock = ((WifiManager) getSystemService(Context.WIFI_SERVICE)) .createWifiLock(WifiManager.WIFI_MODE_FULL, "mywifilock"); myWifiLock.acquire(); // init tcp connector mTCPConn = new TCPConnector(this); // notify others router is up by send ACTION_ROUTER_UP // eg. start remote intent service here Intent startupSignal = new Intent(Router.Intent.ACTION_ROUTER_UP); startService(startupSignal); // add notification and start service at foreground /*Notification notification = new Notification(R.drawable.router_icon, getText(R.string.router_notif_ticker), System.currentTimeMillis());*/ // Instantiate a Builder object. NotificationCompat.Builder builder = new NotificationCompat.Builder(this); builder.setContentTitle(getText(R.string.router_notif_title)) .setTicker(getText(R.string.router_notif_ticker)) .setContentText(getText(R.string.router_notif_message)).setSmallIcon(R.drawable.router_icon); // Intent notificationIntent = new Intent(Router.Intent.ACTION_CONNECTOR); notificationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT); builder.setContentIntent(pendingIntent); // using id of ticker text as notif id startForeground(R.string.router_notif_ticker, builder.build()); }
From source file:com.terminal.ide.TermService.java
@Override public void onCreate() { compat = new ServiceForegroundCompat(this); mTermSessions = new ArrayList<TermSession>(); /**/*from w w w . j a v a 2 s. c om*/ * ?? * @author wanghao * @date 2015-3-27 * ???Activity */ //?intent //warning??start.class //?mainActivity Intent openMainActivityIntent = new Intent(this, mainAvtivity.class); Intent openTerminalActivityIntent = new Intent(this, Term.class); openTerminalActivityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); openMainActivityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Intent exitTerminalIntent = new Intent(this, ExitService.class); Notification sessionBuilder = new NotificationCompat.Builder(this).setSmallIcon(R.drawable.ic_launcher) .setContentTitle(getText(R.string.application_terminal)) .setContentText(getText(R.string.service_notify_text)) .setContentIntent(PendingIntent.getActivity(this, 0, openMainActivityIntent, 0)) .setStyle(new NotificationCompat.BigTextStyle().bigText(getText(R.string.service_notify_text))) .addAction(R.drawable.ic_action_iconfont_terminal, getText(R.string.notification_open_termianl), PendingIntent.getActivity(this, 0, openTerminalActivityIntent, Intent.FLAG_ACTIVITY_CLEAR_TOP)) .addAction(R.drawable.ic_action_iconfont_exit, getText(R.string.notification_exit_app), PendingIntent.getService(this, 0, exitTerminalIntent, 0)) .setOngoing(true).build(); compat.startForeground(RUNNING_NOTIFICATION, sessionBuilder); mPrefs = PreferenceManager.getDefaultSharedPreferences(this); mPrefs.registerOnSharedPreferenceChangeListener(this); mHardKeys.setKeyMappings(mPrefs); //Setup the Hard Key Mappings.. mSettings = new TermSettings(mPrefs); //Need to set the HOME Folder and Bash startup.. //Sometime getfilesdir return NULL ? mSessionInit = false; File home = getFilesDir(); if (home != null) { initSessions(home); } //Start a webserver for comms.. // mServer = new webserver(this); // mServer.start(); PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); WifiManager wm = (WifiManager) getSystemService(Context.WIFI_SERVICE); //Get a wake lock mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TermDebug.LOG_TAG); mScreenLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, TermDebug.LOG_TAG); mWifiLock = wm.createWifiLock(WifiManager.WIFI_MODE_FULL, TermDebug.LOG_TAG); //Get the Initial Values // boolean cpulock = getStringPref("cpulock","1") == 1 ? true : false; // boolean wifilock = getStringPref("wifilock","0") == 1 ? true : false; // boolean screenlock = getStringPref("screenlock","0") == 1 ? true : false; setupWakeLocks(); Log.d(TermDebug.LOG_TAG, "TermService started"); return; }
From source file:com.geryon.ocraa.MusicService.java
@Override public void onCreate() { // Log.i(TAG, "debug: Creating service"); utils = new Utilities(); // Create the Wifi lock (this does not acquire the lock, this just creates it) mWifiLock = ((WifiManager) getSystemService(Context.WIFI_SERVICE)) .createWifiLock(WifiManager.WIFI_MODE_FULL, "mylock"); mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); mAudioManager = (AudioManager) getSystemService(AUDIO_SERVICE); sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory()))); // Create the retriever and start an asynchronous task that will prepare it. mRetriever = new MusicRetriever(getContentResolver()); (new PrepareMusicRetrieverTask(mRetriever, this)).execute(); // create the Audio Focus Helper, if the Audio Focus feature is available (SDK 8 or above) if (android.os.Build.VERSION.SDK_INT >= 8) mAudioFocusHelper = new AudioFocusHelper(getApplicationContext(), this); else//from ww w. j a v a 2s . c o m mAudioFocus = AudioFocus.Focused; // no focus feature, so we always "have" audio focus mDummyAlbumArt = BitmapFactory.decodeResource(getResources(), R.drawable.dummy_album_art); mMediaButtonReceiverComponent = new ComponentName(this, MusicIntentReceiver.class); }
From source file:com.owncloud.android.media.MediaService.java
/** * Initialize a service instance// w w w . ja v a 2 s .c o m * * {@inheritDoc} */ @Override public void onCreate() { super.onCreate(); Log_OC.d(TAG, "Creating ownCloud media service"); mWifiLock = ((WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE)) .createWifiLock(WifiManager.WIFI_MODE_FULL, MEDIA_WIFI_LOCK_TAG); mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); // Configure notification channel if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { NotificationChannel mNotificationChannel; // The user-visible name of the channel. CharSequence name = getString(R.string.media_service_notification_channel_name); // The user-visible description of the channel. String description = getString(R.string.media_service_notification_channel_description); // Set importance low: show the notification everywhere but with no sound int importance = NotificationManager.IMPORTANCE_LOW; mNotificationChannel = new NotificationChannel(MEDIA_SERVICE_NOTIFICATION_CHANNEL_ID, name, importance); // Configure the notification channel. mNotificationChannel.setDescription(description); mNotificationManager.createNotificationChannel(mNotificationChannel); } mNotificationBuilder = new NotificationCompat.Builder(this); mNotificationBuilder.setColor(this.getResources().getColor(R.color.primary)); mAudioManager = (AudioManager) getSystemService(AUDIO_SERVICE); mBinder = new MediaServiceBinder(this); // add AccountsUpdatedListener mAccountManager = AccountManager.get(this); mAccountManager.addOnAccountsUpdatedListener(new OnAccountsUpdateListener() { @Override public void onAccountsUpdated(Account[] accounts) { // stop playback if account of the played media files was removed if (mAccount != null && !AccountUtils.exists(mAccount.name, MediaService.this)) { processStopRequest(false); } } }, null, false); }
From source file:co.shunya.gita.player.MusicService.java
@Override public void onCreate() { // Log.i(TAG, "debug: Creating service"); // Create the Wifi lock (this does not acquire the lock, this just creates it) mWifiLock = ((WifiManager) getSystemService(Context.WIFI_SERVICE)) .createWifiLock(WifiManager.WIFI_MODE_FULL, "mylock"); mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); mAudioManager = (AudioManager) getSystemService(AUDIO_SERVICE); // create the Audio Focus Helper, if the Audio Focus feature is available (SDK 8 or above) if (android.os.Build.VERSION.SDK_INT >= 8) mAudioFocusHelper = new AudioFocusHelper(getApplicationContext(), this); else//www . jav a 2 s . co m mAudioFocus = AudioFocus.Focused; // no focus feature, so we always "have" audio focus mDummyAlbumArt = BitmapFactory.decodeResource(getResources(), R.drawable.krishnanarayana); mMediaButtonReceiverComponent = new ComponentName(this, MusicIntentReceiver.class); BusProvider.getMediaEventBus().register(this); }
From source file:uk.org.ngo.squeezer.service.SqueezeService.java
@Override public void onCreate() { super.onCreate(); // Clear leftover notification in case this service previously got killed while playing NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); nm.cancel(PLAYBACKSERVICE_STATUS);//ww w . j ava2 s .com cachePreferences(); setWifiLock(((WifiManager) getSystemService(Context.WIFI_SERVICE)) .createWifiLock(WifiManager.WIFI_MODE_FULL, "Squeezer_WifiLock")); mEventBus.register(this, 1); // Get events before other subscribers cli.initialize(); }