How does soundcloud web make an android notification - javascript

I am talking about this notification:
Somehow SoundCloud (the website) makes this notification appear and it has working controls. I do not have the app installed, that notification originates from com.android.chrome. I don't really need to know this to reproduce it, but I'm curious as to how it accomplishes this and perhaps in what other ways you can use it.

This is accomplished with Chrome Media Notifications. https://developers.google.com/web/updates/2015/07/media-notifications
To get the playback controls, and other information on the notification, you can customise them by providing meta data with the Media Session API. https://developers.google.com/web/updates/2017/02/media-session

When Android is programmed, it gets certain features that allow it to communicate with web hosts and websites. The website will have to be built a certain way that allows it to be communicative, but that seems to be what's happening in this situation.

Related

How to find whether the user is watching our website or not(it should work when switching applications also)?

I am creating a chat application, where I need to send notifications when the user is not watching my website or working in another application.
Now, most of the use cases can be handled using the page visibility API. But there is a particular use case when the user is switching the application from browser to any other application(ex: Outlook), I want to send a notification at that time.
But the issue here is page visibility API does not provide anything on switching applications. That is if the browser active tab has my website and the user switches the application from browser to any other application, it still thinks the user is looking at my website which is wrong because the user is in anther application right now.
I have done R&D on this and I see it is impossible because browsers can't detect these kinds of changes due to security reasons.
But when I checked with Whatsapp web there, javascript is able to find weather user opened the current application or not and based on that they are sending notifications.
So, How can I implement same feature that Whatsapp guys implemented? Is there any web API I am missing here. Are any hacks available to implement this kind feature?
Thanks in advance.

Web Notification API - website doesn't need to be open?

I noticed some news sites such as Washington Post are able to pop up Web Notifications even though I don't have the site open in a tab. I don't recall this being possible before. How is it even possible for a website to execute the JS necessary if the site isn't open? How does one accomplish this using Web Notifications, is there a particular setting to accomplish this?
I believe they are using Push Notifications via Service Workers.
You can check the current support status to see if it's fit for you. It's well supported in modern browsers (although perhaps not the full specification).
A service worker is a script that your browser runs in the background,
separate from a web page, opening the door to features that don't need
a web page or user interaction. Today, they already include features
like push notifications and background sync.
and
A service worker has a lifecycle that is completely separate from your
web page.

<a href="fb//"> open post/video Link in native App? [duplicate]

Some dev blogs have published information about the "fb://" url scheme for opening various views in the Facebook iPhone App. No matter how much I've searched, I haven't found one word from any official Facebook source about this.
Since the information is public anyways, I'm sure I'm not the only one who'd like to know, whether using this url scheme is officially approved, am I allowed to use it, does it work correctly, and if it's not approved, will it be and what's the approximate schedule for that?
Thanks in advance for any info on this subject!
It's there to support the iOS push notification system (i.e. you get a push notification that says "Friend's Name tagged you in a photo", and you tap on it, it takes you straight to the photo).
I'd assume it's not intended for third party use and therefore subject to change. Hell, Facebook's public-facing APIs are subject to change on a whim anyhow, so I'd be especially cautious about something they hadn't documented.
It's for iOS only. The iOS API lets you define you own URL scheme, so Facebook must have developed their application to register the fb:// URL scheme on iOS devices. It's not a feature that was created by Apple, it's something you, the developer, can make up.
Here are some resources you can investigate
The Facebook iOS SDK
Here on StackOverflow
A tutorial on how it works (not Facebook-specific)
You can use it from your own applications on iOS, but only if the Facebook application is installed. There are, however, plugins and browser extensions out there that mimic the behavior by handling the fb:// schema on your desktop browser.

Can I use the Web API & Play Button Widget for a 3rd Party Spotify Mobile App?

I started building a Spotify Client for BlackBerry 10 using the Web API and the Play Button Widget but still have not published to the store since I want to clear up things first.
Please can anyone tell me if it's okay to use the Web API and the Play Button Widget in my 3rd Part Spotify Mobile App?
I use the Web API for authorization, loading playlists, tracks, albums etc, and I plan to use the Play Button Widget to play the full song.
I also plan to make money from it via Removing the Ads that I will integrate.
Link the the App's Details and Screenshots: http://forums.crackberry.com/blackberry-10-apps-f274/spo2fy-native-spotify-client-blackberry-10-a-948673/
Can somebody advise please?
Right now the Developer Terms of Use forbid monetisation either directly or via adverts for applications that stream audio. The Developer ToS can be found here.
Also, the Play Button widget doesn't work on mobile platforms like Blackberry - it requires a desktop machine as it remote controls either the Web Player or Desktop client.
Additionally, although not part of your question — your app looks like a direct copy of Spotify's own UI. In general, this isn't a good idea. This isn't a threat per se, but it's close enough to potentially look like an "official" client, which is also forbidden by the ToS.

Simple application to aggregate information from multiple web services in fullscreen

Whats the easiest way to build a simple 'web' application which is a single page, that just refreshes itself (using AJAX or something) to display continuously changing data hosted on various different servers on the internet?
I want to interface with (for example) Twitter, Facebook, Skype, Google Calendar, and any number of other services that have some type of web API.
The application does not need to allow user interaction other than to configure it with the authentication parameters needed to access those services.
It should be able to run full-screen with no UI elements showing, just the pretty information I am displaying.
I started to write an HTML file using Jquery but I am running into "Same Origin Policy" issues. Is there a way around this?
I'd love to just write this in Html/Javascript and run it in Google Chrome, is that possible somehow? I don't know how to get around SOP without hosting my own web server as a proxy to cross the domains.
Is there another alternative that is still pretty easy and simple? I looked into using the Windows Vista Sidebar but apparently you can't have a full-screen gadget.
I figured out that I can use the command line option for chrome:
--disable-web-security
And it will allow me to workaround the same origin policy, and since I am using this for a local application I can put the app in a virtual machine and let it run without too much worry.

Categories

Resources