wear-os

How to programatically detect if an app supports Android Wear?

半城伤御伤魂 提交于 2019-11-30 23:17:39
Im trying to detect if an app supports Android Wear or is a watch face. PackageManager pm = getActivity().getPackageManager(); List<PackageInfo> packs = pm.getInstalledPackages(0); for (int i = 0; i < packs.size(); i++) {} Is the code im using. Any feedback or suggestions would be awsome! To check if Android Wear package exists on system: public void foobar() { boolean doesExist = isPackageInstalled("com.google.android.wearable.app"); } private boolean isPackageInstalled(String packagename) { PackageManager pm = getApplicationContext().getPackageManager(); try { pm.getPackageInfo(packagename,

How can I create notification that is different on device and wear?

守給你的承諾、 提交于 2019-11-30 23:01:52
Basically, I am wondering if it is possible to create two different notifications and how - one for Android Device and other for Android Wear? For example: I want to have just setContentText , but on Android device I want setContentTitle and setContentText There is currently no possibility to show notification just on Wear (like setLocalOnly with device only - look for more ). I think the Synchronized Notifications sample that comes with the Android Wear SDK may be useful to look at. It gives three simple types of notifications: (1) A phone-only notification (2) A watch-only notification (3) A

Sending data to android wear device

断了今生、忘了曾经 提交于 2019-11-30 21:18:34
I'm trying to send a String array from my phone to my wear, I've created a service on my phone that is supposed to send the data with this code : public class SendDataService extends Service { private static final String TAG = "SendDataService"; @Override public void onCreate(){ GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() { @Override public void onConnected(Bundle connectionHint) { Log.d(TAG, "onConnected: " + connectionHint); // Now you can use the data layer API } @Override public void

Android Wear sending data to Android phone, but phone appears to never receive it

百般思念 提交于 2019-11-30 20:49:39
Short Summary: I am attempting to send data from an Android Wear watch to an Android phone using PutDataRequest and GoogleApiClient. Logs seem to show the data is sent successfully, but onDataChanged never fires. I am using Android Studio 1.0.2. I am not using any emulator but an Android Wear watch I own--which I have paired and enabled debugging via the Android Wear device and the Android Wear application on the phone. On both the phone and wear's AndroidManifest.xml, I include com.google.android.gms.version. On the Android Phone (4.4.4 version of Android), I use a listener service, which is

Syncing mobile App to Android Wear

浪尽此生 提交于 2019-11-30 20:21:45
According to the doc: Packing wearable Apps I am using the following code: dependencies { compile 'com.google.android.gms:play-services:5.0.+@aar' compile 'com.android.support:support-v4:20.0.+'' wearApp project(':wearable') } I have generated the release version using the Generate Signed APK. The first time when I install the apk the android wear app is installed properly things are working as required. I uninstall the app from my mobile. The android wear app also gets uninstalled without any issues, but if I install the app again in my mobile, I don't see the app in the android wear. I am

How to simulate a service killed by the Android system

丶灬走出姿态 提交于 2019-11-30 20:17:07
While developing I wanted to test the situation where the system kills a service. This is because I'm loosing connection when communicating between the Android Wear and the handheld. And I think that it is related with the system killing some services. Does anyone have a suggestion on how to approach this? cdlc if you're developing in Android Studio while you are running your application in android wear side try to hit the kill button displayed in the console. When you hit this button all the threads + services + activities from this app will be destroyed. If your service is of type "STICKY"

How can I create notification that is different on device and wear?

て烟熏妆下的殇ゞ 提交于 2019-11-30 17:55:10
问题 Basically, I am wondering if it is possible to create two different notifications and how - one for Android Device and other for Android Wear? For example: I want to have just setContentText , but on Android device I want setContentTitle and setContentText There is currently no possibility to show notification just on Wear (like setLocalOnly with device only - look for more). 回答1: I think the Synchronized Notifications sample that comes with the Android Wear SDK may be useful to look at. It

How to programatically detect if an app supports Android Wear?

…衆ロ難τιáo~ 提交于 2019-11-30 17:50:15
问题 Im trying to detect if an app supports Android Wear or is a watch face. PackageManager pm = getActivity().getPackageManager(); List<PackageInfo> packs = pm.getInstalledPackages(0); for (int i = 0; i < packs.size(); i++) {} Is the code im using. Any feedback or suggestions would be awsome! 回答1: To check if Android Wear package exists on system: public void foobar() { boolean doesExist = isPackageInstalled("com.google.android.wearable.app"); } private boolean isPackageInstalled(String

“Default activity not found” for a wearable app created with Android Studio template

烈酒焚心 提交于 2019-11-30 17:30:12
I've created a wear app and used the Android Studio template to create it and haven't made any changes other than to drag and drop a button onto the MainActivity of the wear app. When I try and run the watch app in the Run/Debug Configurations is Launch default Activity is ticked then there is an error message saying: "Error: Default Activity not found". I've searched for previous posting on this and the answer is messing around with module sources and stuff. Is that really the correct solution in this situation? If so, then why isn't the Android Studio setting everything up correctly in the

Android Wear 2.0 styled switches

Deadly 提交于 2019-11-30 16:33:35
I'm making a watch face for my android wear watch and in the config activity I want a switch. The switch looks like a usual android switch ( picture 1 ) but I want it to look like the new switchs in android wear 2.0 ( picture 2 ). How did google do them? The switch in picture 2 is a SwitchPreference which is (at least currently) only supported in a PreferenceFragment . In the latest update we added a RoundSwitch style which should do exactly what you need. See here: Support Library Wear R.style 来源: https://stackoverflow.com/questions/43830167/android-wear-2-0-styled-switches