Example usage for android.content Intent FLAG_ACTIVITY_SINGLE_TOP

List of usage examples for android.content Intent FLAG_ACTIVITY_SINGLE_TOP

Introduction

In this page you can find the example usage for android.content Intent FLAG_ACTIVITY_SINGLE_TOP.

Prototype

int FLAG_ACTIVITY_SINGLE_TOP

To view the source code for android.content Intent FLAG_ACTIVITY_SINGLE_TOP.

Click Source Link

Document

If set, the activity will not be launched if it is already running at the top of the history stack.

Usage

From source file:ch.bfh.instacircle.NetworkActiveActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_network_active);

    // Create the adapter that will return a fragment for each of the three
    // primary sections of the app.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override//from  ww  w.ja v  a2s.c om
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
        }
    });

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
        actionBar
                .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
    }

    // Handle the change of the Wifi configuration
    wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
    adhoc = new AdhocWifiManager(wifi);
    wifiapmanager = new WifiAPManager();
    registerReceiver(wifiReceiver, new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION));

    // Is NFC available on this device?
    nfcAvailable = this.getPackageManager().hasSystemFeature(PackageManager.FEATURE_NFC);

    // only set up the NFC stuff if NFC is also available
    if (nfcAvailable) {
        nfcAdapter = NfcAdapter.getDefaultAdapter(this);
        if (nfcAdapter.isEnabled()) {

            // Setting up a pending intent that is invoked when an NFC tag
            // is tapped on the back
            pendingIntent = PendingIntent.getActivity(this, 0,
                    new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);

            nfcIntentFilter = new IntentFilter();
            nfcIntentFilter.addAction(NfcAdapter.ACTION_NDEF_DISCOVERED);
            nfcIntentFilter.addAction(NfcAdapter.ACTION_TAG_DISCOVERED);
            intentFiltersArray = new IntentFilter[] { nfcIntentFilter };
        } else {
            nfcAvailable = false;
        }
    }
}

From source file:com.tongs.user.gcm.GcmIntentService.java

private void sendNotification(String msg, int mode) {
    final int TICKET = 1;
    final int COUPON = 2;

    long vibrateTime = 0;

    mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);

    Intent intent = null;//from w ww  . j  a v a 2 s  . c om
    PendingIntent contentIntent;
    if (mode == TICKET) { // ticket renew
        intent = new Intent(this, MainActivity.class);
        contentIntent = PendingIntent.getActivity(this, 0, intent, 0);
        vibrateTime = 0;
    } else if (mode == COUPON) { // coupon received
        intent = new Intent(this, CouponActivity.class);
        contentIntent = PendingIntent.getActivity(this, 0, intent, 0);
        vibrateTime = 800;
    } else {
        contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, SignupActivity.class), 0);
        vibrateTime = 1000;
    }

    intent.setFlags(
            Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);

    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.mipmap.ic_launcher).setContentTitle("")
            .setStyle(new NotificationCompat.BigTextStyle().bigText(msg)).setContentText(msg)
            .setVibrate(new long[] { 0, vibrateTime });

    mBuilder.setContentIntent(contentIntent);
    mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
}

From source file:com.battlelancer.seriesguide.ui.BaseNavDrawerActivity.java

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Intent launchIntent = null;//from   ww w . j  a  v a  2s  . c o  m

    switch (position) {
    case MENU_ITEM_SHOWS_POSITION:
        if (this instanceof ShowsActivity) {
            break;
        }
        launchIntent = new Intent(this, ShowsActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
                | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        Utils.trackAction(this, TAG_NAV_DRAWER, "Shows");
        break;
    case MENU_ITEM_LISTS_POSITION:
        if (this instanceof ListsActivity) {
            break;
        }
        launchIntent = new Intent(this, ListsActivity.class).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
        Utils.trackAction(this, TAG_NAV_DRAWER, "Lists");
        break;
    case MENU_ITEM_MOVIES_POSITION:
        if (this instanceof MoviesActivity) {
            break;
        }
        launchIntent = new Intent(this, MoviesActivity.class).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
        Utils.trackAction(this, TAG_NAV_DRAWER, "Movies");
        break;
    case MENU_ITEM_STATS_POSITION:
        if (this instanceof StatsActivity) {
            break;
        }
        launchIntent = new Intent(this, StatsActivity.class).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
        Utils.trackAction(this, TAG_NAV_DRAWER, "Statistics");
        break;
    case MENU_ITEM_SETTINGS_POSITION:
        launchIntent = new Intent(this, SeriesGuidePreferences.class);
        Utils.trackAction(this, TAG_NAV_DRAWER, "Settings");
        break;
    case MENU_ITEM_HELP_POSITION:
        launchIntent = new Intent(this, HelpActivity.class);
        Utils.trackAction(this, TAG_NAV_DRAWER, "Help");
        break;
    case MENU_ITEM_SUBSCRIBE_POSITION:
        if (Utils.isAmazonVersion()) {
            launchIntent = new Intent(this, AmazonBillingActivity.class);
        } else {
            launchIntent = new Intent(this, BillingActivity.class);
        }
        Utils.trackAction(this, TAG_NAV_DRAWER, "Unlock");
        break;
    }

    // already displaying correct screen
    if (launchIntent != null) {
        final Intent finalLaunchIntent = launchIntent;
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                goToNavDrawerItem(finalLaunchIntent);
            }
        }, NAVDRAWER_CLOSE_DELAY);
    }

    mDrawerLayout.closeDrawer(Gravity.START);
}

From source file:com.carpool.dj.carpool.model.GcmIntentService.java

/**
 * Issues a notification to inform the user that server has sent a message.
 *///from  ww  w  . j  av  a  2 s .com
@SuppressWarnings("deprecation")
private static void generateNotification(Context context, String message, Bundle data, String type) {

    int icon = R.drawable.ic_launcher;
    long when = System.currentTimeMillis();
    Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    // Notification notification = new Notification(icon, message, when);
    Notification notification = new Notification.Builder(context)
            .setContentTitle(Utils.nowActivity.getString(R.string.app_name)).setContentText(message)
            .setSmallIcon(icon).setWhen(when).setSound(alarmSound).build();

    // String title = context.getString(R.string.app_name);

    Intent notificationIntent = null;
    if ("CarEvent".equals(type)) {
        notificationIntent = new Intent(context, ContentActivity.class);
    } else {
        return;
    }
    notificationIntent.putExtras(data);
    // set intent so it does not start a new activity
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    notification.setLatestEventInfo(context, Utils.nowActivity.getString(R.string.app_name), message, intent);
    notification.flags |= Notification.FLAG_AUTO_CANCEL;

    notificationManager.notify(0, notification);

}

From source file:com.arcusapp.soundbox.player.MediaPlayerNotification.java

private void setUpMediaPlayerActions() {
    //open the PlayActivity when the user clicks the notification
    Intent notificationIntent = new Intent(SoundBoxApplication.getContext(), MainActivity.class);
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent clickPendingIntent = PendingIntent.getActivity(SoundBoxApplication.getContext(), 1,
            notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    mNotificationBuilder.setContentIntent(clickPendingIntent);

    Intent togglePlayPauseIntent = new Intent(MediaPlayerService.TOGGLEPLAYPAUSE_ACTION, null,
            SoundBoxApplication.getContext(), MediaPlayerService.class);
    PendingIntent togglePlayPausePendingIntent = PendingIntent.getService(SoundBoxApplication.getContext(), 2,
            togglePlayPauseIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    mBaseView.setOnClickPendingIntent(R.id.notificationBasePlay, togglePlayPausePendingIntent);
    mExpandedView.setOnClickPendingIntent(R.id.notificationExpandedPlay, togglePlayPausePendingIntent);

    Intent nextIntent = new Intent(MediaPlayerService.NEXT_ACTION, null, SoundBoxApplication.getContext(),
            MediaPlayerService.class);
    PendingIntent nextPendingIntent = PendingIntent.getService(SoundBoxApplication.getContext(), 3, nextIntent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    mBaseView.setOnClickPendingIntent(R.id.notificationBaseNext, nextPendingIntent);
    mExpandedView.setOnClickPendingIntent(R.id.notificationExpandedNext, nextPendingIntent);

    Intent collapseIntent = new Intent(MediaPlayerService.STOP_ACTION, null, SoundBoxApplication.getContext(),
            MediaPlayerService.class);
    PendingIntent collapsePendingIntent = PendingIntent.getService(SoundBoxApplication.getContext(), 4,
            collapseIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    mBaseView.setOnClickPendingIntent(R.id.notificationBaseCollapse, collapsePendingIntent);
    mExpandedView.setOnClickPendingIntent(R.id.notificationExpandedCollapse, collapsePendingIntent);

    Intent previousIntent = new Intent(MediaPlayerService.PREVIOUS_ACTION, null,
            SoundBoxApplication.getContext(), MediaPlayerService.class);
    PendingIntent previousPendingIntent = PendingIntent.getService(SoundBoxApplication.getContext(), 5,
            previousIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    mExpandedView.setOnClickPendingIntent(R.id.notificationExpandedPrevious, previousPendingIntent);
}

From source file:com.automated.taxinow.GCMIntentService.java

/**
 * Issues a notification to inform the user that server has sent a message.
 *//*from w  w w  . j  av  a2  s. c  o m*/
private void generateNotification(Context context, String message) {
    // System.out.println("this is message " + message);
    // System.out.println("NOTIFICATION RECEIVED!!!!!!!!!!!!!!" + message);
    int icon = R.drawable.ic_launcher;
    long when = System.currentTimeMillis();
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    Notification notification = new Notification(icon, message, when);
    String title = context.getString(R.string.app_name);
    Intent notificationIntent = new Intent(context, MainDrawerActivity.class);
    notificationIntent.putExtra("fromNotification", "notification");
    // set intent so it does not start a new activity
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    notification.setLatestEventInfo(context, title, message, intent);
    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    System.out.println("notification====>" + message);
    notification.defaults |= Notification.DEFAULT_SOUND;
    notification.defaults |= Notification.DEFAULT_VIBRATE;
    // notification.defaults |= Notification.DEFAULT_LIGHTS;
    notification.flags |= Notification.FLAG_SHOW_LIGHTS;
    notification.ledARGB = 0x00000000;
    notification.ledOnMS = 0;
    notification.ledOffMS = 0;
    notificationManager.notify(0, notification);
    PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    PowerManager.WakeLock wakeLock = pm.newWakeLock(
            PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE,
            "WakeLock");
    wakeLock.acquire();
    wakeLock.release();
}

From source file:info.tongrenlu.MediaNotificationManager.java

private PendingIntent createContentIntent() {
    Intent openUI = new Intent(mService, FullScreenPlayerActivity.class);
    openUI.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
    return PendingIntent.getActivity(mService, REQUEST_CODE, openUI, PendingIntent.FLAG_CANCEL_CURRENT);
}

From source file:com.github.sryze.wirebug.DebugStatusService.java

private void updateStatus() {
    Log.i(TAG, "Performing a status update...");

    boolean isEnabled = DebugManager.isTcpDebuggingEnabled();
    if (isEnabled != isCurrentlyEnabled) {
        Log.i(TAG, String.format("Status has changed to %s", isEnabled ? "enabled" : "disabled"));
        sendStatusChangedBroadcast(isEnabled);
    } else {/*from   ww w . jav a2  s  .  c o  m*/
        Log.i(TAG, "Status is unchanged");
    }

    if (keyguardManager.inKeyguardRestrictedInputMode() && preferences.getBoolean("disable_on_lock", false)) {
        Log.i(TAG, "Disabling debugging because disable_on_lock is true");
        DebugManager.setTcpDebuggingEnabled(false);
    }

    if (isEnabled) {
        boolean isConnectedToWifi = NetworkUtils.isConnectedToWifi(connectivityManager);
        Log.d(TAG, String.format("Connected to Wi-Fi: %s", isConnectedToWifi ? "yes" : "no"));

        Intent contentIntent = new Intent(this, MainActivity.class);
        contentIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);

        Intent stopIntent = new Intent(this, DebugStatusService.class);
        stopIntent.setAction(ACTION_STOP);

        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this);
        notificationBuilder.setSmallIcon(R.drawable.ic_notification)
                .setContentTitle(getString(R.string.notification_title))
                .setContentIntent(
                        PendingIntent.getActivity(this, 0, contentIntent, PendingIntent.FLAG_CANCEL_CURRENT))
                .addAction(R.drawable.ic_stop, getString(R.string.notification_action_stop),
                        PendingIntent.getService(this, 0, stopIntent, PendingIntent.FLAG_CANCEL_CURRENT));

        if (isConnectedToWifi) {
            notificationBuilder.setContentText(String.format(getString(R.string.notification_text),
                    NetworkUtils.getWifiIpAddressString(wifiManager),
                    NetworkUtils.getWifiNetworkName(wifiManager)));
        } else {
            notificationBuilder.setContentText(getString(R.string.notification_text_not_connected));
        }

        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
            notificationBuilder.setCategory(Notification.CATEGORY_STATUS)
                    .setVisibility(Notification.VISIBILITY_PUBLIC);
        }

        Notification notification = notificationBuilder.build();
        notification.flags |= Notification.FLAG_NO_CLEAR;
        notificationManager.notify(STATUS_NOTIFICATION_ID, notification);
    } else {
        Log.d(TAG, "Canceling the notification");
        notificationManager.cancel(STATUS_NOTIFICATION_ID);
    }

    if (isEnabled && preferences.getBoolean("stay_awake", false)) {
        if (wakeLock != null && !wakeLock.isHeld()) {
            Log.i(TAG, "Acquiring a wake lock because stay_awake is true");
            wakeLock.acquire();
        }
    } else {
        if (wakeLock != null && wakeLock.isHeld()) {
            Log.i(TAG, "Releasing the wake lock");
            wakeLock.release();
        }
    }

    isCurrentlyEnabled = isEnabled;
}

From source file:com.chilliworks.chillisource.core.LocalNotificationReceiver.java

/**
 * Called when a local notification broad cast is received. Funnels the notification
 * into the app if open or into the notification bar if not
 * /*ww  w .  j ava  2  s .c o m*/
 * @author Steven Hendrie
 * 
 * @param The context.
 * @param The intent.
 */
@SuppressWarnings("deprecation")
@Override
public void onReceive(Context in_context, Intent in_intent) {
    //evaluate whether or not the main engine activity is in the foreground
    boolean isAppInForeground = false;
    if (CSApplication.get() != null && CSApplication.get().isActive() == true) {
        isAppInForeground = true;
    }

    //if the main engine activity is in the foreground, simply pass the
    //notification into it. Otherwise display a notification.
    if (isAppInForeground == true) {
        final Intent intent = new Intent(in_intent.getAction());
        Bundle mapParams = in_intent.getExtras();
        Iterator<String> iter = mapParams.keySet().iterator();

        while (iter.hasNext()) {
            String strKey = iter.next();
            intent.putExtra(strKey, mapParams.get(strKey).toString());
        }

        LocalNotificationNativeInterface localNotificationNI = (LocalNotificationNativeInterface) CSApplication
                .get().getSystem(LocalNotificationNativeInterface.InterfaceID);
        if (localNotificationNI != null) {
            localNotificationNI.onNotificationReceived(intent);
        }
    } else {
        //aquire a wake lock
        if (s_wakeLock != null) {
            s_wakeLock.release();
        }

        PowerManager pm = (PowerManager) in_context.getSystemService(Context.POWER_SERVICE);
        s_wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP
                | PowerManager.ON_AFTER_RELEASE, "NotificationWakeLock");
        s_wakeLock.acquire();

        //pull out the information from the intent
        Bundle params = in_intent.getExtras();
        CharSequence title = params.getString(k_paramNameTitle);
        CharSequence text = params.getString(k_paramNameBody);
        int intentId = params.getInt(LocalNotification.k_paramNameNotificationId);

        int paramSize = params.size();
        String[] keys = new String[paramSize];
        String[] values = new String[paramSize];
        Iterator<String> iter = params.keySet().iterator();
        int paramNumber = 0;
        while (iter.hasNext()) {
            keys[paramNumber] = iter.next();
            values[paramNumber] = params.get(keys[paramNumber]).toString();
            ++paramNumber;
        }

        Intent openAppIntent = new Intent(in_context, CSActivity.class);
        openAppIntent.setAction("android.intent.action.MAIN");
        openAppIntent.addCategory("android.intent.category.LAUNCHER");
        openAppIntent.putExtra(k_appOpenedFromNotification, true);
        openAppIntent.putExtra(k_arrayOfKeysName, keys);
        openAppIntent.putExtra(k_arrayOfValuesName, values);
        openAppIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        PendingIntent sContentIntent = PendingIntent.getActivity(in_context, intentId, openAppIntent,
                PendingIntent.FLAG_UPDATE_CURRENT);

        Bitmap largeIconBitmap = null;
        int LargeIconID = ResourceHelper.GetDynamicResourceIDForField(in_context,
                ResourceHelper.RESOURCE_SUBCLASS.RESOURCE_DRAWABLE, "ic_stat_notify_large");

        //Use small icon if no large icon
        if (LargeIconID == 0) {
            LargeIconID = ResourceHelper.GetDynamicResourceIDForField(in_context,
                    ResourceHelper.RESOURCE_SUBCLASS.RESOURCE_DRAWABLE, "ic_stat_notify");
        }

        if (LargeIconID > 0) {
            largeIconBitmap = BitmapFactory.decodeResource(in_context.getResources(), LargeIconID);
        }

        Notification notification = new NotificationCompat.Builder(in_context).setContentTitle(title)
                .setContentText(text)
                .setSmallIcon(ResourceHelper.GetDynamicResourceIDForField(in_context,
                        ResourceHelper.RESOURCE_SUBCLASS.RESOURCE_DRAWABLE, "ic_stat_notify"))
                .setLargeIcon(largeIconBitmap).setContentIntent(sContentIntent).build();

        NotificationManager notificationManager = (NotificationManager) in_context
                .getSystemService(Context.NOTIFICATION_SERVICE);
        notificationManager.notify(intentId, notification);
        Toast.makeText(in_context, text, Toast.LENGTH_LONG).show();
    }
}

From source file:com.mowares.massagerexpressclient.GCMIntentService.java

/**
 * Issues a notification to inform the user that server has sent a message.
 *///  ww  w . j a  v a 2s . c  o  m

private void generateNotification(Context context, String message) {
    // System.out.println("this is message " + message);
    // System.out.println("NOTIFICATION RECEIVED!!!!!!!!!!!!!!" + message);
    int icon = R.drawable.ic_launcher;
    long when = System.currentTimeMillis();
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    Notification notification = new Notification(icon, message, when);
    String title = context.getString(R.string.app_name);
    Intent notificationIntent = new Intent(context, MainDrawerActivity.class);
    notificationIntent.putExtra("fromNotification", "notification");
    // set intent so it does not start a new activity
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    //notification.setLatestEventInfo(context, title, message, intent);

    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    System.out.println("notification====>" + message);
    notification.defaults |= Notification.DEFAULT_SOUND;
    notification.defaults |= Notification.DEFAULT_VIBRATE;
    // notification.defaults |= Notification.DEFAULT_LIGHTS;
    notification.flags |= Notification.FLAG_SHOW_LIGHTS;
    notification.ledARGB = 0x00000000;
    notification.ledOnMS = 0;
    notification.ledOffMS = 0;
    notificationManager.notify(0, notification);
    PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    PowerManager.WakeLock wakeLock = pm.newWakeLock(
            PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE,
            "WakeLock");
    wakeLock.acquire();
    wakeLock.release();
}