Search code examples
androidwear-osintentfilter

datalayerlistener not receiving messages on wearable (intent filter not working)


I want to send a message to my wearable device. I debugged it to the intent filter in my manifest file, more specifically the data tag in the intent filter I think.

This is the wear manifest file

<service android:name="be.prizorgo.shaketosave.communication.DataLayerListenerService">
        <intent-filter>
            <!--<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />-->
            <action android:name="com.google.android.gms.wearable.DATA_CHANGED" />
            <action android:name="com.google.android.gms.wearable.MESSAGE_RECEIVED" />
            <data android:scheme="mobile" android:host="*"/>
            <action android:name="com.google.android.gms.wearable.CHANNEL_EVENT" />
            <action android:name="com.google.android.gms.wearable.CAPABILITY_CHANGED" />
        </intent-filter>
    </service>

This is where I suppose the problem is. So to be clear if I only use the deprecated bind_listener then it works as soon as I add the data tag it stops working and I don't know why. Is it because I don't use a path in the data tag because I read that it is optional.

So to be clear as soon as I add the data tag it stops working!


Solution

  • Replace <data android:scheme="mobile" android:host="*"/>

    With <data android:scheme="wear" android:host="*"/>