williamrijksen / ti.optimizationpreferences

Show a warning too add huawei/samsung app to protected apps
Other
6 stars 3 forks source link

ti.optimizationpreferences Build Status

This project is to handle protected apps in huawei devices and to prevent your app being killed by the Samsung Smartmanager.

Inspired by:

Follow Guide

Setup

  1. Download the latest version of the module at releases.
  2. Integrate the module into the modules folder and define them into the tiapp.xml file:

    <modules>
      <module platform="android" version="1.1.0">ti.optimizationpreferences</module>
    </modules>

Usage

  1. Show the warning and give the end-user the possiblility to add the app to protected apps

    if (!OS_ANDROID) {
        return;
    }
    
    var optimizationpreferences = require('ti.optimizationpreferences'),
         brands = [optimizationpreferences.HUAWEI, optimizationpreferences.SAMSUNG];
    
    // need warning checks the huawei/samsung activities exists
    if (optimizationpreferences.needWarning(brands)) {
        optimizationpreferences.check(brands);
    }