Use setSiteKeysConfiguration(.) to support sitekeys whitelisting. If the adblock engine provider is not set, it's created by the AdblockWebView instance automatically. tProvider(AdblockHelper.get().getProvider()) Usage example in a simplified way where all blocking subscriptions (like "easylist.txt" or "easylistgermany+easylist.txt") are mapped to the same file R.raw.easylist: Or you can set one general subscription file for all non AA and another for the AA subscription. To set it up in the code, you can either explicitly map all the possible locale-specific subscriptions URLs to local files. gradlew downloadSubscriptionLists, you update the preloaded subscriptions with the latest minified EasyList and minimal exception list. Ideally, you can set a gradle task for that, which is what we did.īy running. This is because subscription lists become outdated very fast. It also increases the footprint of the app by bundling the subscription lists with it, and you have to update the lists when building the apk. On the other hand, this is an opt-in feature that you have to set up. The benefit of using this feature is that it provides a better UX since the app does not have to wait for the subscription lists to be downloaded first, allowing the user to have an ad-blocking experience right away. Keep in mind that the ad-block engine will still periodically check for updates on the subscriptions at an hourly interval. It will also set async calls to update these lists at once so that they are updated as soon as possible. This means that at the application's first boot time, and every time the user clears the app's data, it will load the subscription lists that are bundled with the app. Preloaded subscriptionsĪs mentioned previously, there is an option to set preloaded subscriptions. PreloadSubscriptions to load data from local file first time rather than from the web. The engine, the first synchronization will be done only after some time. If you have configured setDisabledByDefault and then enable If user preference on the enabled state is stored in settings it will haveĪnother thing to take into account is synchronization time. SetDisabledByDefault() only configures the default state. In this case no background operations will be done until you call tEnabled(true). If you want to have ad-blocking as an optional feature, you should consider using setDisabledByDefault Background operationsīy default AdblockEngine will do some background operations like subscriptions synchronizations in the background shortlyĪfter initialized. Or somewhere else where you are sure you are not creating multiple instances (e.g. Thus it's recommended to do the call in Activity Having one instance means that you only have to implement one call toĪdblockHelper.get().getProvider().onLowMemory(). Please mind that if you are using AdblockHelper (which is in most cases), AdblockEngineĮxists only in one instance. If you are using old APIs, it's also possible to use any of onLowMemory() system callbacks:Įither Activity#onLowMemory() or Fragment#onLowMemory(). If you are using or ,īe sure to implement Īnd register it by calling Context#registerComponentCallbacks(ComponentCallbacks2)Īnd then unregister when not needed with Context#unregisterComponentCallbacks(ComponentCallbacks2) if a system demands more memory, call the GC of the adblock engine to release some // this can free up to ~60-70% of memory occupied by the engine if ( level = TRIM_MEMORY_RUNNING_CRITICAL & AdblockHelper. Set GRADLE_BUILD_DIR environment variable to configure build Override public void onTrimMemory( int level) Build directory configurationīy default Gradle uses build directory to build modules, however, it can be undesired.įor some use cases like CI or building as Chromium submodule. (added automatically if building with Gradle or should be added manually otherwise). AAR for SettingsĪn app that uses the library have to add the following permissions to AndroidManifest.xml: AAR for all the ARCHs (x86, armv7a, arm64) This will generate *.aar artifacts in the './build/outputs/aar/' directories:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |