Is there in SDK Android Wear a Class representing a push-button (the push button on the side of the watch)
If it's possible, can I assign a comportment and a method to this push-button, the push-button can be pressed, or clicked, by the user to perform an action.
I found this http://developer.android.com/reference/android/widget/Button. Html
but I think this Class representing a button widget, not what I want
No, there is no way (at this point) to override action for power off button. Also as CurlyCorvus and Nicolas mentioned you provided link to UI Button (not hardware one) class, and you provided screens with non-Android Wear devices.
Related
Is there any way of disabling / enabling the touch events in a certain activity
without disabling certain buttons. like if the phone is "frozen" on a certain activity page for limited time?
I need that the user wont be able to go back on page, slide out or any other events.
Is it possible? (I'm using android studio, java)
Thanks in advance!
Any answer would help :)
It's possible.
Actually there is no special function to make it.
To make it, you can make a full screen button with transparent background.
And you will define a function of the button.
Of course, it will be an empty function.
Well, you can do nothing on the screen.
and then you can hide or visible the button according to your necessary.
I am developing an App that has a lock screen widget where it has a play, pause, prev and next. When I connect my phone to an Android wear, it automatically shows this buttons and it works fine. I would like to add a "Like" button that would automatically be shown on the lock screen and the android wear. I know that I can create a Notification and add action for the like. But I want to know if is it possible to achieve that using only RemoteControlClient?
Have you tried using rating with the flag FLAG_KEY_MEDIA_RATING ? It seems that it's the only way to maintain generic methods and avoid having to set custom code on the wear side (or through notifications).
This flag can be set with setTransportControlFlags
Flag indicating a RemoteControlClient supports ratings. This flag must
be set in order for components that display the RemoteControlClient
information, to display ratings information, and, if ratings are
declared editable (by calling addEditableKey(int) with the
RATING_KEY_BY_USER key), it will enable the user to rate the media,
with values being received through the interface set with
setMetadataUpdateListener(OnMetadataUpdateListener).
Unfortunately, few or not example exists on the web. I discovered only one (unanswered) question relative to this on SO :
Android 4.4 KitKat Rating API
edit
It think all this stuff is now well out of date, there have been many changes to this as android has developed. I'll post an answer when I have worked it out (if noone else has).
I really just want a background app to get first crack at bluetooth messages.
end of edit
I have an android app that needs input from the user - I want to use bluetooth headset buttons (actually bluetooth watch/band buttons - but technically the same!).
I have been looking at media button examples, there are many here and elsewhere which all basically say:-
1) Put receiver/intent in manifest
2) Register receiver in main activity
3) Do processing in the receiver class
This isn't working for me (even cutting and pasting sample code), with no errors, but no events being triggered.
However I also found this:
http://developer.android.com/reference/android/bluetooth/BluetoothHeadset.html
Which is a dedicated bluetooth headset api... has it superceded the media button approach? or is it just higher in the food chain? Should this be used instead of the Media Button Event stuff - or are they just different perspectives?
If the media button stuff is the way, I can post my non-working code, but don't want to waste anyones time if its an out of date approach!
Thanks!
For examples of using bluetooth buttons - this is an excellent example...
https://code.google.com/p/media-button-router/
It detects a hit on the headset 'play' button then pops a dialog asking which app to direct the 'play' to - it plays the choices via the headset so one can be selected without viewing the screen.
I have an android app that uses the java webview. I am wondering if there is a way to create a button or some kind of link within the app to trigger the device to call a specified number. For example, I'm doing an app for a store, and I'd like to have a button that says Call store. Is this possible?
Making the href of your anchor tag point to a 'tel' URI should do the trick:
Call Us!
If your WebView is using a custom WebViewClient, you may need to implement some special logic in 'shouldOverrideUrlLoading'.
See:
Common Intents - Phone
WebView - Handling Navigation
Is it possible to add a google plus button added to my android app and have it linked to the one that one that is displayed at the top of the google play store , below the app name? So that when people click the button in the app, the count on the play store would go up.
According to the G+ docs, a +1 button is associated with a particular URL. So, if you can figure out what URL the +1 button in Google Play is associated to, then you should be able to construct a G+ button following the thread here (that I know you've already seen) with that URL and you should be all set. My best guess is that it's the play store URL associated with your app...http://play.google.com/store/apps/details?id=your.package
Sounds like you also want the user to end up in Google Play after they click? If so, just follow the directions here - perhaps you could subclass PlusOneButton or set some click handler on it (calling super) to allow the whole G+ functionality to work before navigating them to the Play Store.