Android Open Source - WearDisplay Listener Service






From Project

Back to project page WearDisplay.

License

The source code is released under:

MIT License

If you think the Android project WearDisplay listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.randymxj.weardisplay;
//from ww  w . java  2 s. c om
import android.content.Intent;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;

import com.google.android.gms.wearable.MessageEvent;
import com.google.android.gms.wearable.WearableListenerService;

/**
 * Created by Xiaojing on 10/1/2014.
 */

public class ListenerService extends WearableListenerService {

    @Override
    public void onMessageReceived(MessageEvent messageEvent)
    {
        if (messageEvent.getPath().equals("/message_path"))
        {
            final String message = new String(messageEvent.getData());

            // Broadcast message to wearable activity for display
            Intent messageIntent = new Intent();
            messageIntent.setAction(Intent.ACTION_SEND);
            messageIntent.putExtra("message", message);
            LocalBroadcastManager.getInstance(this).sendBroadcast(messageIntent);
        }
        else {
            super.onMessageReceived(messageEvent);
        }
    }
}




Java Source Code List

com.randymxj.weardisplay.ApplicationTest.java
com.randymxj.weardisplay.Config.java
com.randymxj.weardisplay.Config.java
com.randymxj.weardisplay.EnterBarcodeActivity.java
com.randymxj.weardisplay.ListenerService.java
com.randymxj.weardisplay.PhoneActivity.java
com.randymxj.weardisplay.ShowImageActivity.java
com.randymxj.weardisplay.ViewBarcodeActivity.java
com.randymxj.weardisplay.WearActivity.java