WELCOME TO EHOST.COM.NP

Saturday, December 2, 2017

Ambient Lock Screen Music is a Root App that Shows any Music on the Pixel 2’s Ambient Display

ads space

Google’s latest Pixel 2 and Pixel 2 XL flagships have an awesome new feature called “Now Playing.” Using a combination of software, hardware, and machine learning, the Pixel 2 uses an offline database to identify tens of thousands of songs playing in the background. It then displays those songs on your device’s lock screen, always on display, or as an ongoing notification. The feature sounds gimmicky on paper, but after using it myself I found that it works really well. That being said, this kind of feature isn’t everyone’s cup of tea, so XDA Recognized Contributor Quinny899 came up with an app called Ambient Lock Screen Music which allows you to display the name and artist of any currently playing song on your device where the Now Playing text would normally appear.

As you can see in the video above, the developer enables the app and then starts playing a song from Google Play Music. When they show the lock screen, you can see the currently playing song at the bottom where you would normally see the Now Playing feature insert text when it recognizes a song.

The application only works on the Pixel 2/2 XL as it sends an intent whose corresponding intent receiver is only available in the SystemUIGoogle app present on the Pixel 2. Furthermore, the application requires root access in order to function. You can download the application from XDA Labs at the link below.

Ambient Lock Screen Music (Free, XDA Labs) →

It is not only free, but it’s also totally ad-free as well. It supports displaying song titles/artists from almost any music app such as Google Play Music, Spotify, YouTube Red, and more. You can also blacklist apps from showing text on the ambient display. Finally, the app even allows you to double tap on the text shown on the ambient display to launch the music app.


How Ambient Lock Screen Music Works

The Intent

As mentioned previously, this application works by sending an intent to the SystemUIGoogle application. In Quinny899’s app, this is the code responsible for sending the intent:


Intent intent = new Intent("com.google.android.ambientindication.action.AMBIENT_INDICATION_SHOW").putExtra("com.google.android.ambientindication.extra.VERSION", 1).putExtra("com.google.android.ambientindication.extra.TEXT", broadcastString).putExtra("com.google.android.ambientindication.extra.TTL_MILLIS", time);
if(clickIntent != null)intent.putExtra("com.google.android.ambientindication.extra.OPEN_INTENT", clickIntent);
else if(packageName != null) intent.putExtra("com.google.android.ambientindication.extra.OPEN_INTENT", PendingIntent.getActivity(context, 1, context.getPackageManager().getLaunchIntentForPackage(packageName), 0));
intent.setPackage(pName);
context.sendBroadcast(intent, "com.google.android.ambientindication.permission.AMBIENT_INDICATION");

Let’s break this down some. The action in this intent is “com.google.android.ambientindication.action.AMBIENT_INDICATION_SHOW” and it has a few intent extras that can be send with it.

The first extra is “com.google.android.ambientindication.extra.VERSION” which currently just takes an integer value of 1. The next extra is “com.google.android.ambientindication.extra.TEXT” which is where we set the string that we want displayed on the ambient display lock screen. The third extra is “com.google.android.ambientindication.extra.OPEN_INTENT” which accepts a PendingIntent that opens on a double tap of the text. Quinny899 set the PendingIntent to open up whatever application is playing music or a picker for android.intent.action.MUSIC_PLAYER.

Finally, in order to send this intent, the calling app must have the permission “com.google.android.ambientindication.permission.AMBIENT_INDICATION.” This permission is defined as signature|privileged so that is why this app requires root access.

If you want to test this on your own, you can open up a rooted terminal or ADB shell session and enter the following command:


am broadcast -a com.google.android.ambientindication.action.AMBIENT_INDICATION_SHOW --ei com.google.android.ambientindication.extra.VERSION 1 --es com.google.android.ambientindication.extra.TEXT "hello world"

This will display the text “hello world” on the ambient display. It won’t allow you to double click

Displaying the Song

The app has two methods for capturing what song is being played. The first is through MediaController, which requires the app to be bound as a notification listener (though it doesn’t actually mean that the app is intercepting notifications to read the currently playing song). The second is through broadcast receivers which doesn’t require a notification listener (and thus consumes less memory) but is less compatible as some music apps do not send a broadcast intent that this app is set up for.

ads space
ADS SPACE

0 comments:

Post a Comment

Categories

Article How-to All Posts WordPress Android Web design Blogger Plugins CSS Google JQuery Plugins Programming Reviews Web Hosting Blogger Blogging Blogging Tips Tricks Web Development Facebook Git Internet Make Money Online Social Plugins Tips Tips and Tricks Tools Tutorials Windows WordPress Plugins Blogging Tips and Tricks Freebies GSM Google Analytics HTML How To's JavaScript Plugin Development S.E.O SEO SMS SmartPhone Social Media Tips amp; Tricks Top-Most Updates Webmaster Tools Whatsapp Applications Apps Blogger Basics Documentary Downloads Entertainment Gadgets Games Gmail Google AdSense Guest Post IPhone Make Money Blogging SVN Security Softwares Web Hosting Tips and Tricks Wordpress Tips Wordpress Tips and Tricks hostgator iOS Advertising Networks Advertising Technology Affiliates Antivirus Audience amp; Traffic Biography Blog post Blog post Blogger Blogger Errors Blogger Tips Blogger Tools Blogger Widget Blogosphere Bogger Widgets CSS selectors CSS symbols CSS3 Computer amp; Internet Content Writing Coupon Codes Data amp; Analytics Deleted blog Design DoubleClick for Publishers Email and newsletter marketting Email marketing Excel Tips Excel Tips and Tricks Facebook Tricks Feed Feedburner Feedburner subscribers Font Fun GitHub Giveaways Gmail primary inbox Gmail tabs Google sign-in Guides HTML amp; CSS HTML5 Infographics Inspirational Instagram Internet Marketing Internet Tips amp; Tricks Job Listings Knowledge Life Hacks Lists Make-Money Monetization amp; Conversion Monetize Navigation Online Marketing Other PHP Tutorials Passport Publishing amp; Content Quotes RSS Sidebar Smartphones Social Networking Status Tech Tech Blog Technology Telegram Themes UI / UX User Psychology amp; Research VB.Net Web Tools Web browser Widget Windows Tips Windows-10 ad viewability admin notice blogging tools bluehost cherry-pick clone cors custom scrollbar customizer dismissible notices duplicate post feed title git branch git clone gpg gpg2 hybridauth iPad icon font notice responsive wordpress theme same origin policy scrollbar signed git commit smartsvn theme customizer vcs wordpress theme wordpress themes

Blog Archive