Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

android check if app is running

private fun isAppRunning() : Boolean {
        val services = (getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager).runningAppProcesses
        return services.firstOrNull{it.processName.equals(packageName,true)} != null
    }
Comment

PREVIOUS NEXT
Code Example
Java :: java arraylist to string 
Java :: priority queue java comparator lambda 
Java :: jframe actionlistener 
Java :: split every character in string into array java 
Java :: min priority queue in java 
Java :: java docstring javadoc 
Java :: toast no android 
Java :: convert bytebuffer to string 
Java :: java separate the numbers from string 
Java :: java variables in annotations 
Java :: Java Scanner nextLine() 
Java :: java copy array 
Java :: toCharArray() method java 
Java :: how to acces every char of a String in java 
Java :: java flowlayout 
Java :: how to read a excel file in java 
Java :: upload converted base64 to image object to oss without saving in java 
Java :: java random number between 2 values inclusive 
Java :: Java for Keyword 
Java :: thread 
Java :: on touch listener android 
Java :: java method return list 
Java :: how to convert milliseconds into second in android studio 
Java :: running sum of 1d array leetcode 
Java :: array to list java 
Java :: How to connect from Android emulator to application on localhost? 
Java :: How to find the prime factors of a number in Java? 
Java :: java quick sort 
Java :: reverse int array java 
Java :: how to get the max value of an array java 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =