I have created two simple modules in my android project. One module is called handHeld and the other module is called wearable. in the manifest of handHeld i set wearable as a dependency (it was set for me already by the system). I was expecting that when i load handHeld onto a device that it would automatically synch wearable onto the watch but im not seeing that on the emulator (after doing a port fwd). Communication between the watch and device works as i can see notifications appearing and synched. How can i get my wearable app to load onto the watch at the same time as when i install handHeld module onto my device ?
It will only auto-install with an app signed with a release keystore, if you're building the debug version you will need to manually add it to your watch with adb.
Note: The automatic installation of wearable apps does not work when
you are signing apps with a debug key and only works with release
keys. See Packaging Wearable Apps for complete information on how to
properly package wearable apps.
https://developer.android.com/training/wearables/apps/creating.html
Related
I tried to add a wear module to my existing app, tried a lot of solutions, but can't figure out why my app is not being installed on my watch.
What I tried :
First, Manual packaging with my app : https://developer.android.com/training/wearables/apps/packaging.html
But I quickly decided not to go through this.
Then I decided to go to gradle include, so to the build.gradle of app, I added the following to the end of dependencies :
debugWearApp project(path:':wear', configuration: 'flavor1Debug')
releaseWearApp project(path:':wear', configuration: 'flavor1Release')
To the build.gradle of wear, I added the following to the beginning of dependencies :
wearApp project(':wear')
Then, in android{} section of wear build.gradle, just after buildToolsVersion, I added the following :
publishNonDefault true
What I have seen :
No problem to install the wear app to the wear using bluetooth debug of the wear
Then, when I install a generate a release version of my app, I can see in raw, that it has been added a file android_wear_micro_apk.apk to res/raw which is my watch app.
I also saw a file android_wear_micro_apk.xml in res/xml with, from what I guess between hexa codes, the description of wear app.
Then I compare signatures :
keytool -list -printcert -jarfile mobile_app.apk
keytool -list -printcert -jarfile wear_app.apk
Using the wear app generated in res/raw. They exactly have the same signature. Then I compared :
aapt dump badging mobile_app.apk
aapt dump badging wear_app.apk
They have exact same package names and version codes and names.
So, from that :
Apk of wear is correctly added
Apk of wear is working if installed on the wear using adb and bluetooth debug
Both apk have same version code, version name, and package name
Wear is not requiring any permission
Phone is requesting following permissions
android.permission.ACCESS_NETWORK_STATE
android.permission.INTERNET
com.android.vending.BILLING
com.google.android.c2dm.permission.RECEIVE
android.permission.VIBRATE
android.permission.WRITE_EXTERNAL_STORAGE
android.permission.BLUETOOTH
android.permission.BLUETOOTH_ADMIN
com.samsung.accessory.permission.ACCESSORY_FRAMEWORK
com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY
com.samsung.WATCH_APP_TYPE.Companion
com.samsung.wmanager.ENABLE_NOTIFICATION
I'm really wondering what I could have forgotten.
Thanks for any help
According to one of Google’s Android Developer Advocates, Android Wear 2.0 will require completely standalone watch and phone apps, and abandons the system used since the first version of Android Wear that automatically installs Android Wear apps based on the apps you have on your phone.
He puts it plainly in reply to another developer in the Android Wear Developers Google+ community (emphasis ours):
A Wear 2.0 user must visit the Play Store on their watch to install
apps. There is no auto-install like on Wear 1.X. Wear 2.0 apps get
full network access and can be installed completely separately from
the handheld app so the focus is much more on standalone Wear apps
than the handheld centric 1.X Wear apps.
But what about apps built solely for your watch? Well, there's a whole
store worth of apps that go beyond simple notifications and live on
the watch itself. Rather oddly, these still have to be installed
through your smartphone. For now, at least - the new Android Wear 2.0
update will include functionality for standalone apps.
Forum
On the watch:
Settings, Un-pair with phone. (Old release of AW may say Factory
reset.)
Do not set up the watch yet.
On the phone:
In Android Wear use the Disconnect... option.
In Android Wear, use Settings, Device settings and touch the watch
name, Touch FORGET WATCH.
Settings, Bluetooth. If you still see the watch, touch Forget... the
watch so it no longer appears in the list of paired devices.
Settings, Device, Apps, select Google Play Services. Clear cache and
Clear data. Uninstall updates.
Settings, Device, Apps, select Google App. Clear cache and Clear
data. Also Uninstall updates.
Settings, Device, Apps, select Android Wear. Clear cache and Clear
data. Also Uninstall updates.
Play Store, Apps, My apps, touch the Update all button.
You may want to check permissions declared in your app. As mentioned in Requesting Permissions on Android Wear regarding mismatching permission models between wearable and handset app,
If your handset app begins using the Android 6.0 (API level 23) model but your wearable app does not, the system downloads the Wear app, but does not install it. The first time the user launches the app, the system prompts them to grant all pending permissions. Once they do so, it installs the app. If your app, for example a watch face, does not have a launcher, the system displays a stream notification asking the user to grant the permissions the app needs.
The suggested solutions in these SO posts might also help:
Android Wear App not installed
Android Wear app not installing through handset
I want to create an Android wearable app on Android studio. I have installed the apk file on mobile to test run it. I would like to know how I can run the same apk on wearable device.Also, apk file created on Studio is different for wearable and mobile devices. How can we run it? Thanks in advance!
As it mentioned at official website you need to create special package signed by release key. See more info about packaging here.
When developing, you install apps directly to the wearable like with handheld apps. Use either adb install or the Play button on Android Studio.
Note: The automatic installation of wearable apps does not work when you are signing apps with a debug key and only works with release keys.
During the development period, do not use release key for signing. Instead, you should build your app which would result in two apks, one for the phone and one for the wear device. Then install each of them separately on the corresponding device using adb or Android Studio. Make sure you are using the same package names for both apks.
When you are done with your development, then build the app with your release key; then the wear apk will be embedded inside your phone apk and installation of your phone apk on a phone will result in the installation of the embedded wear apk on the wear device (make sure you remove the dev apks from both devices prior to this step otherwise installation will fail due to different keys).
Trying to debug through Android Studio as suggested by Julia and Ali, but it is always showing me Parse error while installing or running the code.
I have created a project for both mobile and wear. While running for mobile it works fine in the mobile device but while running the code in the wear it always shows Parse error.
I am using Moto 360 for running and debugging.
In Android Studio we have two folders
Mobile
Wear.
So which apk should I install on my smartphone, which would sync the corresponding setup to the Android Wear?
DEBUG :
You can install the Mobile apk on smartphone and Wear on your smartwatch, with ADB & plugged into USB
RELEASE :
Just install the Mobile apk on smartphone, this will sync to your wear
So which apk should I install on my smartphone, which would sync the
corresponding setup to the Android Wear?
That's true only when the apk is exported and signed with the production certificate. When you develop, you have to explicitly install the apk, on both devices. You just need to switch between the wearable and handheld application on AndroidStudio, in the drop down menu next to the run button, and choose the device, in the popup which prompt the attached devices
Easiest way to install wearable apk :
Make sure your package name of wearable and mobile are same.Go to AndroidManifest .xml file both these module and check whether these are same or not. If same then ok otherwise you have make them same.
Normally, There two apk's are available in wearable project one is "Mobile APK" and another is "Wearable APK".
We have to build signed apk for "Mobile apk". If any one doesn't know how to build signed apk you ca see this video - Click here
When APK build successfully you can find it in "Your_Project\mobile" folder.
Then send it to your phone which is connected to wearable device.
Then install it on your mobile.
When the handheld app will connect with the wear, it will install/update the wear-apk on the wearable device.
The mobile app can be empty, without Activities, but you have to declare the same package in AndroidManifest for both.
The documentation for packaging wearable apps states:
"... If packaged properly, when users download the handheld app, the
system automatically pushes the wearable app to the paired wearable".
My question is how is it possible to test if the app is actually packaged properly? So that it will install correctly when its parent app is downloaded.
I thought I would be able to test it by:
- resetting the wearable device
- rooting the handheld device and placing the handheld apk in /system/app
- pair the device with the handheld and check the wearable app runs afterwards and thus it must have been installed.
However this didn't work as a test as the handheld app didn't run when placed in /system/app (I got a stopped running error, however the handheld app runs ok when installed normally via adb install).
So how is it possible to test the mobile app has been correctly packaged with the handheld app and will install before releasing it?
Simply check if under the raw package of your app was placed the apk of the wear app. You can open the apk with a simple zip. In addition you have to export your app signing with your key, install it on your smartphone. If the wear app is automatically installed on your smartwatch (or emulator) then the packaging is ok. No root or other operations are needed.
I am working on an application, that is intended for Android wear devices only. I know Google play doesn't support apps that only run on wearable devices (not on handhelds), but this application is for internal purposes only.
I know these
1) I can install directly to wearable devices from eclipse/studio during debugging, just like I do it on handhelds
2) I can use adb command to install directly to wearable device.
But I have created a signed apk of the application, and I want to sent this build to client, who is not a developer and above 2 methods doesn't work. If I sent the apk to him by mail, is there any easy way for him to install it on his wearable?
Note : If it required, consider that client had a handheld device that can sync with this wearable.
You have to build the mobile-signed-apk.
It will contain also the wear-apk. You can send the mobile-signed-apk to your client /by email for example) and he has to install this apk in his handheld device as a normal apk.
When the handheld app will connect with the wear, it will install/update the wear-apk on the wearable device.
You can upload to your developer console it app as alpha and give access for client to alpha testing.