creating media controls on android wear - wear-os

I want to create a wear application that has 2 mode : the connected mode and the disconnected mode. The first mode is used when the watch is connected to the bluetooth : you can control a media player and have the basic controls on what's being played on the phone.
The second mode is used when the mobile is not paired to the watch : you can listen to content on the watch with a bluetooth headset.
My question is the following : on the connected mode, I created my own interface with the basic controls (play/pause/next/previous) and I can synchronize the controls with the phone sending messages via the message api.
Is there a better way to do? Like using the Notifications?

If you want to have the basic media controls on your wear device (controlling then playback of your media app on your phone), then you can use the MediaSessionCompat to handle that for you; take a look at the UniversalMusicPlayer for example; basically if your media app is using the MediaSessionCompat (or MediaSession if you are not concerned with earlier versions of Android), then the basic controls should appear on your watch and if you implement MediSessionComapt.Callback in your media app, framework will send the control commands to your app from your watch.

Related

How can I make the Google Eddystone url notification to make a sound when detected

I am using eddystone beacons to transmit my business url. How can I make the url notification received to alert thru sound on the users device? Any idea?
Understand that Eddystone-URL beacon advertisements don't automatically do anything on a user's phone unless they have an app installed to detect them.
Chrome for iOS and Android (installed on many newer Android devices, but very few iOS devices) will automatically detect Eddystone-URL advertisements and display a notification from Chrome if the user has opted-in. However, no sound is played. Bottom line: on a phone without a custom app, detecting an Eddystone-URL will not cause a sound to play.
If you build a custom app and get it installed on users' devices, you can certainly make it play a sound on Android devices when the beacon is detected. On iOS devices, you could also display a local notification on the device that will play a sound, but only if the user has the volume turned up on the device, does not have do not disturb on, and has opted-in to receiving notifications from the app.

Is it possible to create custom Android Wear notifications?

I have been doing lots of research trying to figure out if it is possible to create wear notifications with custom layouts over the past few months, but am struggling to find a solution.
I have tried to implement the following suggestions to no luck:
https://possiblemobile.com/2014/07/create-custom-ongoing-notification-android-wear/
http://android-wear-docs.readthedocs.org/en/latest/sync.html
Custom UI for Android Wear Notifications
Most of what I have read have instructed that in order to do this, I should create an android wear app with a data listener. The idea being the phone would send certain data to the watch (say a string) based on the type of notification it wants to send. I would disable the automatically generated wear notification. In its place, the Android Wear app listener would know what type of notification it is based on the string and display my custom pages for that notification instead.
My first problem I have run into is I have no idea how to debug code like this. Since in Android studio you can only launch the device app or the wear app, but not both at the same time.
The other question I have is, does the Android Wear app run in the background when the Device App is running? Do you have to open the Android Wear App first for the listener to be even working (if so then I guess this is not a solution to custom notifications)?
Is it actually possible to create custom layout android wear notifications?
If you want to use a custom layout for your notifications, you should create the notification on the watch, following Creating Custom Layouts. You can even make the custom notifications clickable, you can add actions that will open activities on the watch, etc.
For that, you can send a message from your phone to your watch and the listener implemented on your watch will receive it and then, create and display the notification using the correct layout corresponding to the message sent, for example.
In this case, the best way is to implement a WearableListenerService on your wearable. Its lifecycle is handled by the system which binds it only when necessary.
To debug, you install the wear app on the wear emulator or your watch, you install the mobile app on your phone and finally you connect the two following this tutorial if you're using the emulator or via bluetooth if you're using a watch (link in the tutorial).
The Android Wear app connects your phone to your watch, whether it is an emulator or not. So, in order for your message to be received, you must have connected wear and mobile via Android Wear. Then, once the connection is established, you don't necessarily need to keep it open. So yes, the Android Wear app runs in background.

Android Wear: custom apperance for notification

How to implement such appearance for notification card using Android Wear SDK?
Demo video — http://youtu.be/tKoQatxG0_8?t=26s
It has the same custom layout in preview and active mode. But I cannot achieve such behaviour using setDisplayIntent and related API for creating custom layouts. I checked samples of wear apps from SDK, it also has different views for preview and active mode of custom layout notifications.
Oh no!
Right now it's hidden API, so Google can make such appearance for standard apps, but other third-party developers are out of the board.
Confirmed by +Wayne Piekarski — https://plus.google.com/u/0/+BenoitBoDLubek/posts/2o4SVBhWg5z
So the answer is impossible at current moment.

How to start an app on the device with voice commands or by tapping on the icon in Android Wear Device?

In Android Wear it shows the notification and we can reply back through wearable device. But how to start any app from the Wearable device like voice input("Ok Google") or tap on the icon. Action should start from the wearable device not from mobile.
For Example to start my mobile's camera through Android Wear Device i will give voice input as "start Camera" and camera should start.
With the current preview-version of the SDK, this is not possible yet.
But looking at http://developer.android.com/wear/design/user-interface.html tells you, that this will possible using the "Cue Cards".
You can do this now! :)
With the release of the Wear SDK (API Level 20, Android 4.4W), you can now develop Wear applications with very much the same stack as standard Android apps (i.e. Activities, Services, Layouts, Views, &c).
There is also an API for communication, which for example Google Play Music uses to control media playback from the watch.Therefore, you could develop an application, installed both in the Wear device and in the handheld, to launch the phone's camera when started (by sending the command from the Wear activity).

WP7:LivesmoothStreaming is not working with device

We're building a LIVE Smooth Streaming WP7 App.It works perfectly on the emulator, but not on device (shows up blank).
We are also trying smf player for streaming on WP7 but every time we are getting a blank screen on player. Its only work on Emulator.
Though there is no error being thrown.
How i can apply live streaming on my windows phone not on emulator.
looking for your responce
Does your streaming source contain multi-resolution tracks?
This kind of problem may appear when testing on a WP8 Emulator and then deploying the app to a WP7 device. Specially if the WP7 device is a first-generation device, like HTC HD7.
Basically this happens because the WP8 emulator and Wp8 devices do support multi-resolution, but old devices do not support multi-resolution tracks. You can read more here: http://blog.supaywasi.com/2013/01/smooth-streaming-multi-resolution-support-for-windows-phone/
So, basically you have to handle the ManifestReady event on your WP7 app and RestrictTracks to only tracks of the same resolution.
For WP8 devices you will not need to this.

Resources