How to use service to get the information of which app is opened?How to `getTopActivity` name or get currently running application package name in lollipop?How to check if a service is running on Android?Is quitting an application frowned upon?How can I open a URL in Android's web browser from my application?Start an Activity with a parameterHow do I get the APK of an installed app without root access?Can't start Eclipse - Java was started but returned exit code=13What are the Android SDK build-tools, platform-tools and tools? And which version should be used?Mipmap drawables for iconsHow to make app lock app in android?Outdated Kotlin Runtime warning in Android Studio

Why don't modern jet engines use forced exhaust mixing?

A Magic Diamond

What's the point of writing that I know will never be used or read?

Why can't I see 1861 / 1871 census entries on Freecen website when I can see them on Ancestry website?

Have made several mistakes during the course of my PhD. Can't help but feel resentment. Can I get some advice about how to move forward?

Why should I pay for an SSL certificate?

What was the intention with the Commodore 128?

How to render "have ideas above his station" into German

Why was ramjet fuel used as hydraulic fluid during Saturn V checkout?

Can I submit a paper computer science conference using an alias if using my real name can cause legal trouble in my original country

Gofer work in exchange for Letter of Recommendation

Build a mob of suspiciously happy lenny faces ( ͡° ͜ʖ ͡°)

Do I need to start off my book by describing the character's "normal world"?

Ending a line of dialogue with "?!": Allowed or obnoxious?

Is it alright to say good afternoon Sirs and Madams in a panel interview?

How do the Durable and Dwarven Fortitude feats interact?

Why is the battery jumpered to a resistor in this schematic?

Regression when x and y each have uncertainties

How does the illumination of the sky from the sun compare to that of the moon?

Polar contour plot in Mathematica?

What's a good pattern to calculate a variable only when it is used the first time?

Representing an indicator function: binary variables and "indicator constraints"

Subgroup generated by a subgroup and a conjugate of it

Trying to understand how Digital Certificates and CA are indeed secure



How to use service to get the information of which app is opened?


How to `getTopActivity` name or get currently running application package name in lollipop?How to check if a service is running on Android?Is quitting an application frowned upon?How can I open a URL in Android's web browser from my application?Start an Activity with a parameterHow do I get the APK of an installed app without root access?Can't start Eclipse - Java was started but returned exit code=13What are the Android SDK build-tools, platform-tools and tools? And which version should be used?Mipmap drawables for iconsHow to make app lock app in android?Outdated Kotlin Runtime warning in Android Studio






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am a newbie to android. I am developing an app locker that uses face id instead of normal pin/pattern using kotlin.
I have got the list of installed apps in the system. But, how to get the information about which app is opened using service Please help.










share|improve this question






























    0















    I am a newbie to android. I am developing an app locker that uses face id instead of normal pin/pattern using kotlin.
    I have got the list of installed apps in the system. But, how to get the information about which app is opened using service Please help.










    share|improve this question


























      0












      0








      0








      I am a newbie to android. I am developing an app locker that uses face id instead of normal pin/pattern using kotlin.
      I have got the list of installed apps in the system. But, how to get the information about which app is opened using service Please help.










      share|improve this question














      I am a newbie to android. I am developing an app locker that uses face id instead of normal pin/pattern using kotlin.
      I have got the list of installed apps in the system. But, how to get the information about which app is opened using service Please help.







      android kotlin applocker






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 27 at 13:34









      Faizan AliFaizan Ali

      1




      1

























          1 Answer
          1






          active

          oldest

          votes


















          0














          Like this:



          Java version



           private String retriveAppInForeground() 
          String currentApp = null;
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1)
          UsageStatsManager usm = (UsageStatsManager) this.getSystemService(Context.USAGE_STATS_SERVICE);
          long time = System.currentTimeMillis();
          List<UsageStats> appList = null;
          if (usm != null)
          appList = usm.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, time - 1000 * 1000, time);

          if (appList != null && !appList.isEmpty())
          SortedMap<Long, UsageStats> sortedMap = new TreeMap<>();
          for (UsageStats usageStats : appList)
          sortedMap.put(usageStats.getLastTimeUsed(), usageStats);

          if (!sortedMap.isEmpty())
          currentApp = sortedMap.get(sortedMap.lastKey()).getPackageName();


          else
          ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
          if (am != null)
          currentApp =(am.getRunningTasks(1).get(0)).topActivity.getPackageName();


          Log.e("ActivityTAG", "Application in foreground: " + currentApp);
          return currentApp;




          Kotlin version



           private fun retriveAppInForeground(): String? 
          var currentApp: String? = null
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1)
          val usm = this.getSystemService(Context.USAGE_STATS_SERVICE) as UsageStatsManager
          val time = System.currentTimeMillis()
          val appList: List<UsageStats>?
          appList = usm.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, time - 1000 * 1000, time)
          if (appList != null && appList.isNotEmpty())
          val sortedMap = TreeMap<Long, UsageStats>()
          for (usageStats in appList)
          sortedMap.put(usageStats.lastTimeUsed, usageStats)

          currentApp = sortedMap.takeIf it.isNotEmpty() ?.lastEntry()?.value?.packageName

          else
          val am = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
          @Suppress("DEPRECATION") //The deprecated method is used for devices running an API lower than LOLLIPOP
          currentApp = am.getRunningTasks(1)[0].topActivity.packageName

          Log.e("ActivityTAG", "Application in foreground: " + currentApp)
          return currentApp




          Make sure your app has the proper permissions for accessing the usage stats:



          <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/>



          And that the user grants the proper permission, you can take the user to the proper settings screen to enable the permission (when setting up your app):



          startActivity(new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS));



          And one more thing, always make sure you search for any similar question before posting a new one.






          share|improve this answer



























          • Can you explain this piece of code, SortedMap<Long, UsageStats> mySortedMap = new TreeMap<>(); . An error pops up when i convert this to kotlin.

            – Faizan Ali
            Mar 28 at 5:29











          • The TreeMap is for easier keeping entries order and accessing the latest one. What exact error is popping up? I just added the Kotlin version for your reference... You can also make that function a static one inside a PackageUtil class, for example.

            – Hugo Allexis Cardona
            Mar 29 at 0:04











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55378514%2fhow-to-use-service-to-get-the-information-of-which-app-is-opened%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Like this:



          Java version



           private String retriveAppInForeground() 
          String currentApp = null;
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1)
          UsageStatsManager usm = (UsageStatsManager) this.getSystemService(Context.USAGE_STATS_SERVICE);
          long time = System.currentTimeMillis();
          List<UsageStats> appList = null;
          if (usm != null)
          appList = usm.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, time - 1000 * 1000, time);

          if (appList != null && !appList.isEmpty())
          SortedMap<Long, UsageStats> sortedMap = new TreeMap<>();
          for (UsageStats usageStats : appList)
          sortedMap.put(usageStats.getLastTimeUsed(), usageStats);

          if (!sortedMap.isEmpty())
          currentApp = sortedMap.get(sortedMap.lastKey()).getPackageName();


          else
          ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
          if (am != null)
          currentApp =(am.getRunningTasks(1).get(0)).topActivity.getPackageName();


          Log.e("ActivityTAG", "Application in foreground: " + currentApp);
          return currentApp;




          Kotlin version



           private fun retriveAppInForeground(): String? 
          var currentApp: String? = null
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1)
          val usm = this.getSystemService(Context.USAGE_STATS_SERVICE) as UsageStatsManager
          val time = System.currentTimeMillis()
          val appList: List<UsageStats>?
          appList = usm.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, time - 1000 * 1000, time)
          if (appList != null && appList.isNotEmpty())
          val sortedMap = TreeMap<Long, UsageStats>()
          for (usageStats in appList)
          sortedMap.put(usageStats.lastTimeUsed, usageStats)

          currentApp = sortedMap.takeIf it.isNotEmpty() ?.lastEntry()?.value?.packageName

          else
          val am = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
          @Suppress("DEPRECATION") //The deprecated method is used for devices running an API lower than LOLLIPOP
          currentApp = am.getRunningTasks(1)[0].topActivity.packageName

          Log.e("ActivityTAG", "Application in foreground: " + currentApp)
          return currentApp




          Make sure your app has the proper permissions for accessing the usage stats:



          <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/>



          And that the user grants the proper permission, you can take the user to the proper settings screen to enable the permission (when setting up your app):



          startActivity(new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS));



          And one more thing, always make sure you search for any similar question before posting a new one.






          share|improve this answer



























          • Can you explain this piece of code, SortedMap<Long, UsageStats> mySortedMap = new TreeMap<>(); . An error pops up when i convert this to kotlin.

            – Faizan Ali
            Mar 28 at 5:29











          • The TreeMap is for easier keeping entries order and accessing the latest one. What exact error is popping up? I just added the Kotlin version for your reference... You can also make that function a static one inside a PackageUtil class, for example.

            – Hugo Allexis Cardona
            Mar 29 at 0:04
















          0














          Like this:



          Java version



           private String retriveAppInForeground() 
          String currentApp = null;
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1)
          UsageStatsManager usm = (UsageStatsManager) this.getSystemService(Context.USAGE_STATS_SERVICE);
          long time = System.currentTimeMillis();
          List<UsageStats> appList = null;
          if (usm != null)
          appList = usm.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, time - 1000 * 1000, time);

          if (appList != null && !appList.isEmpty())
          SortedMap<Long, UsageStats> sortedMap = new TreeMap<>();
          for (UsageStats usageStats : appList)
          sortedMap.put(usageStats.getLastTimeUsed(), usageStats);

          if (!sortedMap.isEmpty())
          currentApp = sortedMap.get(sortedMap.lastKey()).getPackageName();


          else
          ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
          if (am != null)
          currentApp =(am.getRunningTasks(1).get(0)).topActivity.getPackageName();


          Log.e("ActivityTAG", "Application in foreground: " + currentApp);
          return currentApp;




          Kotlin version



           private fun retriveAppInForeground(): String? 
          var currentApp: String? = null
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1)
          val usm = this.getSystemService(Context.USAGE_STATS_SERVICE) as UsageStatsManager
          val time = System.currentTimeMillis()
          val appList: List<UsageStats>?
          appList = usm.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, time - 1000 * 1000, time)
          if (appList != null && appList.isNotEmpty())
          val sortedMap = TreeMap<Long, UsageStats>()
          for (usageStats in appList)
          sortedMap.put(usageStats.lastTimeUsed, usageStats)

          currentApp = sortedMap.takeIf it.isNotEmpty() ?.lastEntry()?.value?.packageName

          else
          val am = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
          @Suppress("DEPRECATION") //The deprecated method is used for devices running an API lower than LOLLIPOP
          currentApp = am.getRunningTasks(1)[0].topActivity.packageName

          Log.e("ActivityTAG", "Application in foreground: " + currentApp)
          return currentApp




          Make sure your app has the proper permissions for accessing the usage stats:



          <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/>



          And that the user grants the proper permission, you can take the user to the proper settings screen to enable the permission (when setting up your app):



          startActivity(new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS));



          And one more thing, always make sure you search for any similar question before posting a new one.






          share|improve this answer



























          • Can you explain this piece of code, SortedMap<Long, UsageStats> mySortedMap = new TreeMap<>(); . An error pops up when i convert this to kotlin.

            – Faizan Ali
            Mar 28 at 5:29











          • The TreeMap is for easier keeping entries order and accessing the latest one. What exact error is popping up? I just added the Kotlin version for your reference... You can also make that function a static one inside a PackageUtil class, for example.

            – Hugo Allexis Cardona
            Mar 29 at 0:04














          0












          0








          0







          Like this:



          Java version



           private String retriveAppInForeground() 
          String currentApp = null;
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1)
          UsageStatsManager usm = (UsageStatsManager) this.getSystemService(Context.USAGE_STATS_SERVICE);
          long time = System.currentTimeMillis();
          List<UsageStats> appList = null;
          if (usm != null)
          appList = usm.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, time - 1000 * 1000, time);

          if (appList != null && !appList.isEmpty())
          SortedMap<Long, UsageStats> sortedMap = new TreeMap<>();
          for (UsageStats usageStats : appList)
          sortedMap.put(usageStats.getLastTimeUsed(), usageStats);

          if (!sortedMap.isEmpty())
          currentApp = sortedMap.get(sortedMap.lastKey()).getPackageName();


          else
          ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
          if (am != null)
          currentApp =(am.getRunningTasks(1).get(0)).topActivity.getPackageName();


          Log.e("ActivityTAG", "Application in foreground: " + currentApp);
          return currentApp;




          Kotlin version



           private fun retriveAppInForeground(): String? 
          var currentApp: String? = null
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1)
          val usm = this.getSystemService(Context.USAGE_STATS_SERVICE) as UsageStatsManager
          val time = System.currentTimeMillis()
          val appList: List<UsageStats>?
          appList = usm.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, time - 1000 * 1000, time)
          if (appList != null && appList.isNotEmpty())
          val sortedMap = TreeMap<Long, UsageStats>()
          for (usageStats in appList)
          sortedMap.put(usageStats.lastTimeUsed, usageStats)

          currentApp = sortedMap.takeIf it.isNotEmpty() ?.lastEntry()?.value?.packageName

          else
          val am = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
          @Suppress("DEPRECATION") //The deprecated method is used for devices running an API lower than LOLLIPOP
          currentApp = am.getRunningTasks(1)[0].topActivity.packageName

          Log.e("ActivityTAG", "Application in foreground: " + currentApp)
          return currentApp




          Make sure your app has the proper permissions for accessing the usage stats:



          <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/>



          And that the user grants the proper permission, you can take the user to the proper settings screen to enable the permission (when setting up your app):



          startActivity(new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS));



          And one more thing, always make sure you search for any similar question before posting a new one.






          share|improve this answer















          Like this:



          Java version



           private String retriveAppInForeground() 
          String currentApp = null;
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1)
          UsageStatsManager usm = (UsageStatsManager) this.getSystemService(Context.USAGE_STATS_SERVICE);
          long time = System.currentTimeMillis();
          List<UsageStats> appList = null;
          if (usm != null)
          appList = usm.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, time - 1000 * 1000, time);

          if (appList != null && !appList.isEmpty())
          SortedMap<Long, UsageStats> sortedMap = new TreeMap<>();
          for (UsageStats usageStats : appList)
          sortedMap.put(usageStats.getLastTimeUsed(), usageStats);

          if (!sortedMap.isEmpty())
          currentApp = sortedMap.get(sortedMap.lastKey()).getPackageName();


          else
          ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
          if (am != null)
          currentApp =(am.getRunningTasks(1).get(0)).topActivity.getPackageName();


          Log.e("ActivityTAG", "Application in foreground: " + currentApp);
          return currentApp;




          Kotlin version



           private fun retriveAppInForeground(): String? 
          var currentApp: String? = null
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1)
          val usm = this.getSystemService(Context.USAGE_STATS_SERVICE) as UsageStatsManager
          val time = System.currentTimeMillis()
          val appList: List<UsageStats>?
          appList = usm.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, time - 1000 * 1000, time)
          if (appList != null && appList.isNotEmpty())
          val sortedMap = TreeMap<Long, UsageStats>()
          for (usageStats in appList)
          sortedMap.put(usageStats.lastTimeUsed, usageStats)

          currentApp = sortedMap.takeIf it.isNotEmpty() ?.lastEntry()?.value?.packageName

          else
          val am = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
          @Suppress("DEPRECATION") //The deprecated method is used for devices running an API lower than LOLLIPOP
          currentApp = am.getRunningTasks(1)[0].topActivity.packageName

          Log.e("ActivityTAG", "Application in foreground: " + currentApp)
          return currentApp




          Make sure your app has the proper permissions for accessing the usage stats:



          <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/>



          And that the user grants the proper permission, you can take the user to the proper settings screen to enable the permission (when setting up your app):



          startActivity(new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS));



          And one more thing, always make sure you search for any similar question before posting a new one.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 29 at 0:03

























          answered Mar 27 at 13:51









          Hugo Allexis CardonaHugo Allexis Cardona

          5259 silver badges18 bronze badges




          5259 silver badges18 bronze badges















          • Can you explain this piece of code, SortedMap<Long, UsageStats> mySortedMap = new TreeMap<>(); . An error pops up when i convert this to kotlin.

            – Faizan Ali
            Mar 28 at 5:29











          • The TreeMap is for easier keeping entries order and accessing the latest one. What exact error is popping up? I just added the Kotlin version for your reference... You can also make that function a static one inside a PackageUtil class, for example.

            – Hugo Allexis Cardona
            Mar 29 at 0:04


















          • Can you explain this piece of code, SortedMap<Long, UsageStats> mySortedMap = new TreeMap<>(); . An error pops up when i convert this to kotlin.

            – Faizan Ali
            Mar 28 at 5:29











          • The TreeMap is for easier keeping entries order and accessing the latest one. What exact error is popping up? I just added the Kotlin version for your reference... You can also make that function a static one inside a PackageUtil class, for example.

            – Hugo Allexis Cardona
            Mar 29 at 0:04

















          Can you explain this piece of code, SortedMap<Long, UsageStats> mySortedMap = new TreeMap<>(); . An error pops up when i convert this to kotlin.

          – Faizan Ali
          Mar 28 at 5:29





          Can you explain this piece of code, SortedMap<Long, UsageStats> mySortedMap = new TreeMap<>(); . An error pops up when i convert this to kotlin.

          – Faizan Ali
          Mar 28 at 5:29













          The TreeMap is for easier keeping entries order and accessing the latest one. What exact error is popping up? I just added the Kotlin version for your reference... You can also make that function a static one inside a PackageUtil class, for example.

          – Hugo Allexis Cardona
          Mar 29 at 0:04






          The TreeMap is for easier keeping entries order and accessing the latest one. What exact error is popping up? I just added the Kotlin version for your reference... You can also make that function a static one inside a PackageUtil class, for example.

          – Hugo Allexis Cardona
          Mar 29 at 0:04









          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55378514%2fhow-to-use-service-to-get-the-information-of-which-app-is-opened%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript