A modularized audio ad blocker for Android

Overview

Kotlin App codebeat badge

ad-free

ad-free is a research project attempting to show flaws in the way how audio advertisement is shown on Android. It is a proof-of-concept of a modularized audio ad blocker written in Kotlin with a modern and simplistic user interface.

https://adfree.abertschi.ch

Features

  • No ROOT required
  • Turn off sound when advertisement is playing
  • Play arbitrary audio instead of advertisements
  • Plugin based design
  • Support for Spotify
  • Support for Soundcloud (experimental)
  • Mute Google Chromecast (experimental)

Download

Download the latest release from the F-Droid store.

Legality

This app is free and opensource and does not seek a comercial interest. It does not collect user data. It is a proof-of-concept to show flaws in the way how audio advertisement is often implemented on Android. Ad-free's algorithms are described below and its source code is freely available. It does not alter or "hack" protection measures of music players, and only gathers context information provided by the Android runtime. Nontheless, ad-free may be against terms of services of music players. Muting commercials may not be supported and may result in a temporary ban. Use at your own risk.

Troubleshooting

See Troubleshooting section for help to get ad-free up and running.

Changelog

See Changelog for a list of implemented features in new releases.

Implementation notes

Ad detection

Advertisement detectors are modularized into implementations of AdDetectable. An instance of AdDetectable can determine if a track being played is advertisement or not.

Ad Free registers an NotificationListenerService and is therefore able to parse all incoming notifications on Android. Notifications are parsed by implementations of AdDetectable:

  • TitleDetector:
    Detector which parses notifications for certain keywords. In order to avoid false positives, an notification action is provided to unblock wrongly detected advertisements.

  • NotificationActionDetector:
    Detector which inspects notifications for properties set in the track navigation bar.

  • NotificationBundleAndroidTextDetector:
    Detector which checks for properties set in the notification bundle.

  • More

Ad blocking

AudioManager, Android's Audio System provides several streams on which audio can be played. Music players play audio on the stream STREAM_MUSIC. In case of ad detection, Ad Free mutes STREAM MUSIC and calls a configured AdPlugin. AdPlugins aim to replace advertisement. They play music on an alternative stream and are therefore not affected by the mute of STREAM MUSIC.

Plugins

Mute Audio

As the title of this plugin suggests, it only mutes adertisments without playing sound.

Play local music

Play music tracks stored on your phone while advertisement is playing. At the moment .mp3, .wav, and .m4a are supported.

Interdimensional Cable (discontinued)

Interdimensional Cable replaces advertisements with interdimensional cable advertisements featured in Adult Swim's Rick and Morty TV series.

Due to legal reasons and a rise in popularity, this feature is no longer supported. See here.

Credits

  • The bird and website icons used in this app are made by Freepik from www.flaticon.com and are licensed by CC 3.0 BY.

  • This app is written in Kotlin. Kotlin by Jetbrains is lisenced by the Apache Lisence 2.0

  • RxAndroid by the RxAndroid authors is licensed by the Apache License 2.0

  • Fuel is made by Kittinun Vantasin and is licensed by MIT

  • snakeyaml is licensed by the Apache License 2.0

  • XStream by Joe Walnes and the XStream Committers is lisenced by BSD license.

Licence

This project is lisenced by the Apache Lisence 2.0

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IT IS A PROOF OF CONCEPT AND INTENDED TO BE A RESEARCH PROJECT. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Comments
  • Ad is detected but the ad continues to play.

    Ad is detected but the ad continues to play.

    I am using a OnePlus 7T, ad-free detects that an ad is being played but it does nothing about it, the ad continues to play.

    PS: I'm using the mute plug-in.

    bug device-specific 
    opened by debasish-patnaik 13
  • request: Accuradio support

    request: Accuradio support

    thank you very much for this app, still works like a charm. in addition to adding a +1 to previously posted requests for other apps (notably Deezer and Spotify Lite) i was wondering if it could be extended to Accuradio. thank you for your time.

    opened by unseenlarks 7
  • Unmutes a few seconds too early, playing endings of ads.

    Unmutes a few seconds too early, playing endings of ads.

    Using Essential phone PH-1, using latest version of Spotify and Ad-Free. Most of the time, the phone would unmute before the ad finishes so a few seconds of ads would be played. Is there any way to unmute at the right time? Even just extend a few more seconds to mute the music would be less distracting.

    enhancement 
    opened by roadie 7
  • F-Droid build failed

    F-Droid build failed

    > Task :app:lintVitalRelease FAILED
    /builds/2/fdroiddata/build/ch.abertschi.adfree/app/build.gradle:10: Error: Google Play requires that apps target API level 30 or higher.
     [ExpiredTargetSdkVersion]
            targetSdkVersion 27
            ~~~~~~~~~~~~~~~~~~~
       Explanation for issues of type "ExpiredTargetSdkVersion":
       As of the second half of 2018, Google Play requires that new apps and app
       updates target API level 26 or higher.
       Configuring your app to target a recent API level ensures that users
       benefit from significant security and performance improvements, while still
       allowing your app to run on older Android versions (down to the
       minSdkVersion).
       To update your targetSdkVersion, follow the steps from "Meeting Google Play
       requirements for target API level",
       https://developer.android.com/distribute/best-practices/develop/target-sdk.
       html
       https://support.google.com/googleplay/android-developer/answer/113469#targetsdk
       https://developer.android.com/distribute/best-practices/develop/target-sdk.html
    1 errors, 0 warnings
    FAILURE: Build failed with an exception.
    * What went wrong:
    Execution failed for task ':app:lintVitalRelease'.
    > Lint found fatal errors while assembling a release target.
      
      Fix the issues identified by lint, or create a baseline to see only new errors:
    

    android { lint { baseline = file("lint-baseline.xml") } }

    
    For more details, see https://developer.android.com/studio/write/lint#snapshot
    

    Could you please take a look? Thanks!

    opened by linsui 6
  • Sound is played from phone speaker when headphones are plugged in

    Sound is played from phone speaker when headphones are plugged in

    Phone: Samsung S8, latest vendor firmware (Android 9).

    When listening to Spotify with headphones (wired, jack), the interdimensional cable is played on the phone's loudspeaker.

    Thanks for the awesome software! ;-)

    bug 
    opened by hydrandt 5
  • Mutes when playing a podcast on Spotify

    Mutes when playing a podcast on Spotify

    When ever I play any podcast it automatically mutes. It works fine for ads but it shouldn't happen for my currently playing podcast. I'm using OnePlus 6, android os 10. Oxygen OS 10.3.6

    bug 
    opened by githubashutoshsoni 4
  • After 1.0, activates on all songs

    After 1.0, activates on all songs

    I'm running Android 6.0.1. I have tried it with Spotify 8.5.36.747 and the beta 8.5.39.234. It activates as soon as I start playing music on Spotify and will not stop. I tried upgrading to 1.2.1 to see if it worked, as I have been downgrading back to 1.0 each time. I did not keep a copy of the apk, and now it is removed from F-Droid. Is there a way to remedy this or downgrade back to 1.0, so I can use the app? Edit: I have found a copy of the apk from F-Droid's website on the Wayback Machine, which again, does function as expected. Is there any reason why 1.0 works but newer versions do not?

    bug device-specific 
    opened by ogrefriend 4
  • "Play until end" - funny but confusing

    I really like that some developers try to put some funny features into their apps. Really appreciate them making me smiling. But I don't understand "Play until end" option...

    There should be two options only: "play local music file until spotify ad ends" or "play until end of music file, regardless if spotify ad already ended before".

    opened by kojid0 4
  • Remove

    Remove "full network access"-permission

    What does Ad-Free need full network access for? I guess it has been added in order to download the music file of Interdimensional Cable but this feature has been discontinued.

    Since As-Free has full access to notifications, it could technically (!) upload user notifications somewhere (yes, it's open source and in F-Droid). I truly believe that it doesn't, but if this permission is not necessarily needed, it should be removed.

    Also, for what does the app need "view network connections" and "read the contents of your shared storage" permissions?

    enhancement 
    opened by kojid0 3
  • fix bug

    fix bug "Unable to add window -- token android.os.BinderProxy is not valid"

    related to the file chooser view for selection of audio tracks.

    Android version: 28
    Device: samsung SM-G960U
    App version: 33
    Time: 2019-11-25-22:09:20
    Root cause:
    android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@99507bb is not valid; is your activity running?
    at android.view.ViewRootImpl.setView(ViewRootImpl.java:1056)
    at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:381)
    at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:93)
    at android.app.Dialog.show(Dialog.java:470)
    at com.github.angads25.filepicker.view.FilePickerDialog.show(FilePickerDialog.java:417)
    at ch.abertschi.adfree.plugin.localmusic.LocalMusicView.showFolderSelectionDialog(LocalMusicView.kt:98)
    at ch.abertschi.adfree.plugin.localmusic.LocalMusicPlugin.chooseDirectory(LocalMusicPlugin.kt:141)
    at ch.abertschi.adfree.plugin.localmusic.LocalMusicView$onCreate$4.onClick(LocalMusicView.kt:71)
    at android.view.View.performClick(View.java:7333)
    at android.widget.TextView.performClick(TextView.java:14160)
    at android.view.View.performClickInternal(View.java:7299)
    at android.view.View.access$3200(View.java:846)
    at android.view.View$PerformClick.run(View.java:27773)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:6986)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)
    
    bug 
    opened by abertschi 3
  • Spotify Lite support

    Spotify Lite support

    Spotify lite is out of beta currently at 0.13.0.79 version, tested it and the ad blocking is not working. The notifications seem similar to the normal app. Any chance to get support for it? Thank you

    feature-request 
    opened by th3m 3
  • Add CodeQL workflow for GitHub code scanning

    Add CodeQL workflow for GitHub code scanning

    Hi abertschi/ad-free!

    This is a one-off automatically generated pull request from LGTM.com :robot:. You might have heard that we’ve integrated LGTM’s underlying CodeQL analysis engine natively into GitHub. The result is GitHub code scanning!

    With LGTM fully integrated into code scanning, we are focused on improving CodeQL within the native GitHub code scanning experience. In order to take advantage of current and future improvements to our analysis capabilities, we suggest you enable code scanning on your repository. Please take a look at our blog post for more information.

    This pull request enables code scanning by adding an auto-generated codeql.yml workflow file for GitHub Actions to your repository — take a look! We tested it before opening this pull request, so all should be working :heavy_check_mark:. In fact, you might already have seen some alerts appear on this pull request!

    Where needed and if possible, we’ve adjusted the configuration to the needs of your particular repository. But of course, you should feel free to tweak it further! Check this page for detailed documentation.

    Questions? Check out the FAQ below!

    FAQ

    Click here to expand the FAQ section

    How often will the code scanning analysis run?

    By default, code scanning will trigger a scan with the CodeQL engine on the following events:

    • On every pull request — to flag up potential security problems for you to investigate before merging a PR.
    • On every push to your default branch and other protected branches — this keeps the analysis results on your repository’s Security tab up to date.
    • Once a week at a fixed time — to make sure you benefit from the latest updated security analysis even when no code was committed or PRs were opened.

    What will this cost?

    Nothing! The CodeQL engine will run inside GitHub Actions, making use of your unlimited free compute minutes for public repositories.

    What types of problems does CodeQL find?

    The CodeQL engine that powers GitHub code scanning is the exact same engine that powers LGTM.com. The exact set of rules has been tweaked slightly, but you should see almost exactly the same types of alerts as you were used to on LGTM.com: we’ve enabled the security-and-quality query suite for you.

    How do I upgrade my CodeQL engine?

    No need! New versions of the CodeQL analysis are constantly deployed on GitHub.com; your repository will automatically benefit from the most recently released version.

    The analysis doesn’t seem to be working

    If you get an error in GitHub Actions that indicates that CodeQL wasn’t able to analyze your code, please follow the instructions here to debug the analysis.

    How do I disable LGTM.com?

    If you have LGTM’s automatic pull request analysis enabled, then you can follow these steps to disable the LGTM pull request analysis. You don’t actually need to remove your repository from LGTM.com; it will automatically be removed in the next few months as part of the deprecation of LGTM.com (more info here).

    Which source code hosting platforms does code scanning support?

    GitHub code scanning is deeply integrated within GitHub itself. If you’d like to scan source code that is hosted elsewhere, we suggest that you create a mirror of that code on GitHub.

    How do I know this PR is legitimate?

    This PR is filed by the official LGTM.com GitHub App, in line with the deprecation timeline that was announced on the official GitHub Blog. The proposed GitHub Action workflow uses the official open source GitHub CodeQL Action. If you have any other questions or concerns, please join the discussion here in the official GitHub community!

    I have another question / how do I get in touch?

    Please join the discussion here to ask further questions and send us suggestions!

    opened by lgtm-com[bot] 0
  • [FR] Pause app playback until the ad-substitution music ends

    [FR] Pause app playback until the ad-substitution music ends

    Currently, if I use local music mode and set play until end to true, the ad-substitution music will play until end, but the ad is usually far shorter than that. Consequently, when the music player app, Spotify, for example, is unmuted again, it has been playing its own music for a while.

    It will be better for me to have ad-free somehow pause the music playback of Spotify (maybe simulating a media control key?) when the ad ends while substitution music still playing. After that, restart playback when unmuting Spotify.

    Thank you for your awsome work! :smile:

    feature-request 
    opened by proItheus 0
  • ISSUE with detection function using two different audio sources

    ISSUE with detection function using two different audio sources

    Issue: This app will not mute the ad source unless it is coming from one single source.

    SCENARIO: So if you stream music via Spotify to your bluetooth speaker and decide to watch something on your phone or play a game. The app will mute the audio of the app currently streaming audio to the phones speakers but not mute the source for a bluetooth speaker. If you play the audio streams to one device (phone, bluetooth, wired speaker, etc) it will correctly detect the right app to mute. But it won't work if the music streaming app that has ads is separated from the phone source while the phone is still using other apps that produce sound.

    I hope that makes sense... If you wish to replicate this then set the spotify app to play from a bluetooth speaker and load up a game on your phone with its output directed via your phone.

    enhancement 
    opened by makoto-kokoroki 1
  • Request: Pandora Support

    Request: Pandora Support

    It shows the word "AD" in notification when ad is playing so I think it's not a complicated ad so hoping you can add it!

    Thank you for this app!

    feature-request 
    opened by famewolf 0
Releases(v2.2)
Owner
Andrin Bertschi
I like science, milk and late night walks
Andrin Bertschi
Silky - Android application to convert videos from applications such as YouTube, Facebook, Twitter into audio (.mp3)

Silky Español (actualmente la app se encuentra en desarrollo ) Descripcion Aplic

null 2 Aug 24, 2022
Video/Audio Downloader for Android, written with Jetpack Compose.

Seal Video/Audio Downloader for Android, written with Jetpack Compose.

junkfood 2.1k Dec 29, 2022
A fork of audio-analyzer-for-android in Google code, with a lot of enhancement.

Audio Spectrum Analyzer for Android A fork of Audio spectrum Analyzer for Android (See README.old for its original readme) This software shows the fre

null 74 Jan 1, 2023
A radio player mobile application which streams audio from Radio Sai Global Harmony.

A radio player mobile application which streams audio from Radio Sai Global Harmony.

Sai Rajendra Immadi 11 Nov 26, 2022
Fermata Media Player is a free, open source audio and video player with a simple and intuitive interface.

Fermata Media Player About Fermata Media Player is a free, open source audio and video player with a simple and intuitive interface. It is focused on

Andrey 227 Jan 6, 2023
Radio Player - A Flutter plugin to play streaming audio content with background support and lock screen controls.

A Flutter plugin to play streaming audio content with background support and lock screen controls. Installation To use this package, add

Ayotunde abdulsalam 1 Mar 14, 2022
mpv-android is a video player for Android based on libmpv.

mpv-android is a video player for Android based on libmpv.

null 1.1k Jan 6, 2023
FFmpeg compiled for Android. Execute FFmpeg commands with ease in your Android app.

FFMPEG video operations FFmpeg compiled for Android. Execute FFmpeg commands with ease in your Android app. Getting Started This project is provide in

Simform Solutions 277 Jan 2, 2023
Echo is a lightweight and minimal music player for Android, built with Android Studio and written in Kotlin

Echo - Echo, A light-weight, minimal music player for Android, with shuffle, favorites and audio visualization

Divins Mathew 0 Feb 7, 2022
Youtube Android Clone 🚀an Android Youtube Clone made out of XML and Kotlin

Youtube Android Clone ?? This app consumes The Youtube Api to fetch and display a list of popular videos, The app uses MVVM design pattern to allow se

Breens Robert 38 Dec 13, 2022
An extensible media player for Android

ExoPlayer ExoPlayer is an application level media player for Android. It provides an alternative to Android’s MediaPlayer API for playing audio and vi

Google 20.2k Jan 1, 2023
Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.

ijkplayer Platform Build Status Android iOS Video player based on ffplay Download Android: Gradle # required allprojects { repositories {

bilibili 31k Jan 3, 2023
Custom Android view with video player, loader and placeholder image

VideoPlayerView Custom Android view with video player, loader and placeholder image. To stay up-to-date with news about the library Usage Here is an e

Marcin Moskała 89 Nov 18, 2022
[] FFmpeg build for android random architectures with example jni

AndroidFFmpegLibrary This project aims to create working library providing playing video files in android via ffmpeg libraries. With some effort and N

AppUnite Sp. z o.o. Spk. 1.1k Dec 27, 2022
Emotion recognition by speech in android.

Vokaturi - Android Library Android port of the Vokaturi emotion recognition API. Overview Vokaturi is an emotion recognition software, that can unders

Owais 82 Nov 11, 2022
Free p2p cdn android github sdk to reduce video streaming costs of live and on demand video using webrtc by upto 90% and improve scalability by 6x - 🚀 Vadootv 🚀

Android p2p cdn sdk to distribute load and reduce costs(https://peervadoo.com) Vadootv is a p2p sdk integration to reduce your video streaming costs b

Vadootv 40 Oct 5, 2022
A better Android VideoView with more Media Controller customization. 一个更好用的Android VideoView

Android UniversalVideoView 中文版说明请点击这里 UniversalVideoView is a Android widget helps playing video easier, which is similar with the Android system nati

Linsea 978 Nov 30, 2022
Android Texture VideoView having a variety of scale types like the scale types of ImageView such as fitCenter, centerCrop, centerTopCrop and more

Android-ScalableVideoView Looking for the extra scale types of ImageView? Check out ScalableImageView. Android Texture VideoView having a variety of s

Yoshihito Ikeda 1.1k Jan 7, 2023