mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-08 20:09:24 +00:00
add wakelock for android
This commit is contained in:
parent
f021dbf6a6
commit
e84f122956
2 changed files with 18 additions and 0 deletions
|
@ -13,6 +13,7 @@ import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
|
||||||
import com.unstoppabledomains.resolution.DomainResolution;
|
import com.unstoppabledomains.resolution.DomainResolution;
|
||||||
import com.unstoppabledomains.resolution.Resolution;
|
import com.unstoppabledomains.resolution.Resolution;
|
||||||
|
@ -39,6 +40,14 @@ public class MainActivity extends FlutterFragmentActivity {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
switch (call.method) {
|
switch (call.method) {
|
||||||
|
case "enableWakeScreen":
|
||||||
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
|
handler.post(() -> result.success("screen wake turned ON"));
|
||||||
|
break;
|
||||||
|
case "disableWakeScreen":
|
||||||
|
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
|
handler.post(() -> result.success("screen wake turned OFF"));
|
||||||
|
break;
|
||||||
case "sec_random":
|
case "sec_random":
|
||||||
int count = call.argument("count");
|
int count = call.argument("count");
|
||||||
SecureRandom random = new SecureRandom();
|
SecureRandom random = new SecureRandom();
|
||||||
|
|
|
@ -13,6 +13,7 @@ import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
|
||||||
import com.unstoppabledomains.resolution.DomainResolution;
|
import com.unstoppabledomains.resolution.DomainResolution;
|
||||||
import com.unstoppabledomains.resolution.Resolution;
|
import com.unstoppabledomains.resolution.Resolution;
|
||||||
|
@ -39,6 +40,14 @@ public class MainActivity extends FlutterFragmentActivity {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
switch (call.method) {
|
switch (call.method) {
|
||||||
|
case "enableWakeScreen":
|
||||||
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
|
handler.post(() -> result.success("screen wake turned ON"));
|
||||||
|
break;
|
||||||
|
case "disableWakeScreen":
|
||||||
|
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
|
handler.post(() -> result.success("screen wake turned ON"));
|
||||||
|
break;
|
||||||
case "sec_random":
|
case "sec_random":
|
||||||
int count = call.argument("count");
|
int count = call.argument("count");
|
||||||
SecureRandom random = new SecureRandom();
|
SecureRandom random = new SecureRandom();
|
||||||
|
|
Loading…
Reference in a new issue