Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syncing mobile App to Android Wear

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 not sure why this is happening. I have tried the same with different apps that that are compatible with android wear those work fine. Install and uninstall and install again, I can see them on android wear emulator.

Here is the build.gradle file from my Application folder:

apply plugin: 'com.android.application'

android {
compileSdkVersion 20
buildToolsVersion '20.0.0'

defaultConfig {
    applicationId "com.ysk.notes"
    minSdkVersion 9
    targetSdkVersion 20
    versionCode 3
    versionName "1.02"
}
buildTypes {
    release {
        runProguard true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
 }
}

dependencies
      {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        compile project(':FacebookSDK')
        compile files('libs/activation.jar')
        compile files('libs/additionnal.jar')
        compile files('libs/mail.jar')
        compile 'com.google.android.gms:play-services:5.0.+@aar'
        compile 'com.android.support:support-v4:20.0.+'
        wearApp project(':Wearable')




        configurations
                {
                    all*.exclude group: 'com.android.support', module: 'support-v4'
                }
    }

Can somebody let me know where I am going wrong?

like image 556
TheDevMan Avatar asked Jul 17 '14 08:07

TheDevMan


2 Answers

I had this problem where the wear app wouldn't install. So I made sure the mobile app was installed (after exporting singed APK and doing an ADB INSTALL), then opened the Android Wear app, pressed the gears icon at the top and then selected Resync apps.

like image 135
Gregg Reno Avatar answered Oct 12 '22 23:10

Gregg Reno


I have two suggestions for you that may help.

1) You mention you're using the wear emulator instead of a real watch device. I have experienced issues with connecting and syncing the emulator. Try resetting the emulator and reconnecting through Android Wear on your phone (aka running adb -d forward tcp:5601 tcp:5601) again.

2) There seems to be some caching of versionCode on the Phone and it uses that to know if it needs to resync and update the app on the watch. Try incrementing your versionCode and see if that helps.

Hope one of those helps.

like image 38
Michael DePhillips Avatar answered Oct 12 '22 23:10

Michael DePhillips