Skip to content

Instantly share code, notes, and snippets.

View Diego-Franco's full-sized avatar
:octocat:
building crazy things

Diego Franco Diego-Franco

:octocat:
building crazy things
  • Chime
  • San Francisco, CA
View GitHub Profile
@Diego-Franco
Diego-Franco / isDeviceLocked.java
Created April 4, 2018 21:25 — forked from Jeevuz/isDeviceLocked.java
Check device is currently locked
/**
* Returns true if the device is locked or screen turned off (in case password not set)
*/
public static boolean isDeviceLocked(Context context) {
boolean isLocked = false;
// First we check the locked state
KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
boolean inKeyguardRestrictedInputMode = keyguardManager.inKeyguardRestrictedInputMode();
@Diego-Franco
Diego-Franco / AndroidManifest.xml
Created July 28, 2017 00:16 — forked from cdsap/AndroidManifest.xml
Example ManifestPlaceHolder
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapplication" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
@Diego-Franco
Diego-Franco / Foreground.java
Created December 2, 2016 03:43 — forked from steveliles/Foreground.java
Class for detecting and eventing whether an Android app is currently foreground or background (requires API level 14+)
package com.sjl.util;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import java.util.List;