This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
android { | |
... | |
// Override the android:testOnly="true" attribute that the new build tools set so that debug APKs can be installed normally | |
applicationVariants.all { variant -> | |
variant.outputs.all { output -> | |
output.processManifest.doLast { | |
String manifestPath = "$manifestOutputDirectory/AndroidManifest.xml" | |
def manifestContent = file(manifestPath).getText() | |
manifestContent = manifestContent.replace('android:testOnly="true"', 'android:testOnly="false"') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// package declaration, imports... | |
public class ForegroundLifecycleCallback implements Application.ActivityLifecycleCallbacks { | |
private int startedActivitiesCount = 0; | |
@Override | |
public void onActivityStarted(Activity activity) { | |
if (startedActivitiesCount == 0) { | |
// your foreground stuff | |
} |