Git Product home page Git Product logo

cromappwhitelist's Introduction

CRomAppWhitelist

Maven Central

Quick setting to add your app to whitelist for Chinese Android ROM

Motivation behind this project

Because the open of Android ecosystem and the absence of Google services in Chinese market, the Android ROM manufatured by Chinese company has a big different with the others in other part of the world.

They are deeply customized Android, when your application run on this devices, you barely know what strange behavoirs will bring to your app. These restriction can let some of the features of your app are unfunctional, it's unfriendly from the users perspectives. Here I give several examples

  • app is been kill after screen off, in order to save battery
  • app don't allow notification before Android 6.0
  • app's service with Service.START_STICKY not restart after the service kill

If your app is not covering thousands and millions of users, like Wechat, your app is not on the whiltelist of the phone manufacture. So the only way is telling the user and guide them to add your app to the whiltelist, if your app's main features rely on some features which are disable by the ROMs.

How to use

This library has been published to jCenter, just apply following dependency in your gradle file

implementation 'io.github.wanghonglin:crom-app-whitelist:0.1.2'

Then the following code will navigate you the the specific whitelist feature settings.

AppWhitelist.settingForAutoStart(this);
AppWhitelist.settingForBatterySaver(this);
AppWhitelist.settingForMemoryAcceleration(this);
AppWhitelist.settingForNotification(this);

Will guide the user (with a Intent to start the Activity) to setting and add to the whiltelist if the device has these features.

The component name of these activities usually obtained with the following command which run in the device shell

$ adb shell dumpsys activity activities |grep 'Focused\|ResumedActivity'

Currently tested devices

  • Xiaomi
  • Meizu
  • Samsung
  • Oppo
  • Huawei

Patches for more devices are welcome!

More ROM or devices support

You can add more settings support new rom or devices, just add appwhitelist.json file into your app's asset root directory.

The library will read and resolve appwhitelist.json which have higher priority to launch setting intent.

Below is an example

{
  "auto_start": [{
    "pkg": "com.huawei.systemmanager",
    "cls": "com.huawei.systemmanager.appcontrol.activity.StartupAppControlActivity"
  }, {
    "pkg": "com.huawei.xxx",
    "cls": "com.huawei.xxx.XActivity"
  }],
  "battery_saver": [],
  "mem_acc": [],
  "notification": []
}
  • A functionality for different ROMs grouped together
  • There are four different functionality settings, include the functionality you want to add as main key
    • auto_start for auto start settings
    • battery_saver for battery saver settings
    • mem_acc for memory acceleration settings
    • notification for notification settings
  • In order to support multiple roms or manufactures, each functionality include a list of component for settings, the library will resolve them from begin to end until a resolvable intent is found, then the library will startActivity with this resolved intent and lead the user to settings page

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

cromappwhitelist's People

Contributors

wanghonglin avatar ebhsgit avatar zeronfinity avatar

Forkers

sweatco

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.