Code Monkey home page Code Monkey logo

ti.watchdog's Introduction

Ti.Watchdog

This module tries to solve this issue

Install

To use your module locally inside an app you can copy the zip file into the app root folder and compile your app. The file will automatically be extracted and copied into the correct modules/ folder.

If you want to use your module globally in all your apps you have to do the following:

macOS

Copy the distribution zip file into the ~/Library/Application Support/Titanium folder

Linux

Copy the distribution zip file into the ~/.titanium folder

Project Usage

Register your module with your application by editing tiapp.xml and adding your module. Example:

<modules>
  <module platform="android">de.appwerft.watchdog</module>
</modules>

Entry in AndroidManifest

<receiver android:name="de.appwerft.watchdog.Watchdog"/>

When you run your project, the compiler will combine your module along with its dependencies and assets into the application.

Example Usage

import SleepDeprivation from 'de.appwerft.watchdog';
SleepDeprivation.start({
	interval : 10*1000*60, // ms
	debug : true,
	exact : false,
	startdelay : 0
});
// and optional 
SleepDeprivation.stop();

You can use start() without parameters. In this case it uses the default parameters (10 min, debuging on, inexact, immediately)

Alternatives

function requestIgnoreBatteryOptimizations() {
	if (Ti.Platform.Android.API_LEVEL >= 23) {
		const intent = Ti.Android.createIntent({
			action : "android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS",
			data : "package:" + Ti.App.Android.launchIntent.packageName,
		});
		Ti.Android.currentActivity.startActivity(intent);
		Ti.App.Properties.setBool('IgnoreBatteryOptimizations', true);
	}
}

Disadvantages of this dialog

  • some manufactures (Samsung Huawei, Nokia) ignore this white list.
  • this intent has no result

More: here

ti.watchdog's People

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.