0

I am trying to send to send a message from handheld to wear-emulator, (according to this tutorial). Unfortunately my WearableListenerService.onMessageReceived doesn't get called.

Here on SO I have read it could be somehow related with gradle.build file,

my gradle.build in 'mobile' module (handheld):

apply plugin: 'com.android.application'

android {
compileSdkVersion 20
buildToolsVersion "20.0.0"

defaultConfig {
    applicationId "com.example.benji.data"
    minSdkVersion 15
    targetSdkVersion 20
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(':wear')
compile 'com.google.android.gms:play-services-wearable:+'
}

my gradle.build in 'wear' module:

apply plugin: 'com.android.application'

android {
compileSdkVersion 20
buildToolsVersion "20.0.0"

defaultConfig {
    applicationId "com.example.benji.data"
    minSdkVersion 20
    targetSdkVersion 20
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.support:wearable:+'
compile 'com.google.android.gms:play-services-wearable:+'
}

I have everything else set up as it is in the previously mentioned tutorial.

Thanks for any possible answers

romanos
  • 1,288
  • 2
  • 11
  • 20

2 Answers2

0

Problem relies in modules start order, first launch Handheld module app, and THEN wear emulator app, not vice-versa as I did before :)

romanos
  • 1,288
  • 2
  • 11
  • 20
0

It's work for me

If you use Proguard to protect your apk , you need to ensure that the Gson class won't be Proguard, If you use the Gson class

Like this ProGuard for Android and GSON

Then you must ensure that the apk on your phone and wear must have the same signature, in other word, you need to use the same KeyStore file to export the singed APK.

Community
  • 1
  • 1
Angus
  • 91
  • 2