Online advertisements continue finding new ways to annoy the crap out of you. For the past few years, one particular form of online advertisements have plagued mobile devices: the vibrating ad. Using the Vibration API, advertisements have been vibrating your phone to annoyingly grab your attention. This issue has been known for years, but Google was very slow to resolve the issue. Only with Chrome version 60 are vibrating advertisements done away with, but as of now version 60 is only available in the Beta, Dev, and Canary channels of Chrome. However, there's actually a way to manually stop vibrations from any Android app on your phone – without completely putting your phone into silent mode. That means you won't have to wait for application developers to update their apps so they can't vibrate your phone.
Stop Vibrations from Any Android App
The method we are doing is quite simple. All we will be doing is restricting the permission that allows an app to use the device's vibration motor by sending an ADB command. In doing so, the app can't vibrate your phone. Before we begin, we need to install an application so we can figure out what the name of the package is for the app we want to stop vibrations on our phone. Don't worry, it's a totally free (and small) app.
App Inspector (Free, Google Play) →
- Install the USB drivers for your particular device, likely only needed if you're on Windows.
- Download the ADB binary for your OS.
- Extract the ZIP file into an easily accessible folder on like Downloads.
- Go to Settings on your phone find the About Phone option.
- Find the "Build Number" value here and tap on it 7 times to enable Developer Mode.
- Go back to the main menu in Settings and enter Developer Options.
- Enable USB Debugging Mode.
- Plug your phone into the computer and change it from "charge only" mode to "file transfer (MTP)" mode. This is not always necessary but it may be required on your device for ADB to work.
- Go back to the PC and navigate to the directory where you extracted the ADB binary earlier.
- Launch a Command Prompt (Terminal on Mac/Linux) in this ADB directory. On Windows, the fastest way to do this is to hold Shift and then Right-click. In the context menu that pops up, choose the "open command prompt here" option.
- Once in the Command Prompt or Terminal, enter the following command to verify that we can connect to the device:
adb devices
- This will start the ADB daemon. If this is your first time running ADB, you will see a prompt asking you to authorize a connection. Allow it.
- Now re-run the command from step 11 and you'll see the serial number of your device in the output. If so, then you're ready to move on. If not, try re-installing the drivers.
- Find the package for the app that you want to restrict from vibrating phone by opening App Inspector, going to the App List, then tapping on the app.
- Execute the following command to enter the shell environment of your phone:
adb shell
- Then execute this command to restrict the app from using the vibration motor:
cmd appops set <package> VIBRATE ignore
- You won't see any confirmation in the prompt, but as long as you don't get an error message it should have worked.
Explanation
So what we are doing here is restricting the permission android.permission.VIBRATE
from an application of our choosing. This permission is defined by applications in their AndroidManifest.xml
file and upon installation the application is automatically granted. Although you can restrict some permissions from applications using the built-in permission manager, the VIBRATE permission is not one of them.
Instead, we restrict this permission by using the cmd appops
command. This is a command line interface to "appops" – Android's user-facing permission management system. By accessing this system through an ADB shell, we have access to restricting many more permissions than we normally would be able to. One of those permissions we can revoke is the VIBRATE permission. And by doing so, we stop vibrations as the application can no longer use your phone's vibration motor without the required permission.
Google doesn't want you to be able to restrict this permission normally, so they hid it from the Settings. This is because many app's rely on vibrating your phone for legitimate reasons, such as haptic feedback for certain actions or by notifying you of something. Google left in the command-line ability to prevent an app from vibrating your phone so developers could test how their app would work if the phone doesn't have a vibration motor. However, devices without vibrations motors is such a rare occurrence that this command mostly goes unused.
Still, just because this hidden command is unused by developers doesn't mean we can't put it to good use. Indeed, thanks to this command we can stop vibrations from any Android app ever again! No need to wait on Google to update the Chrome Stable version or for Opera to update Opera Mini, you can stop vibrating ads yourself right now! Furthermore, if you know of any app that gives you headaches by vibrating your phone too much (and they don't allow you to turn that off), now you can stop that from happening too. Next up, we hope Google Chrome's ad blocker kills these kinds of advertisements, though we've only had a few days to test that new feature.
from xda-developers http://ift.tt/2vAmTCk
via IFTTT
No comments:
Post a Comment