HelloWorld for Google Glass

I am trying to make a HelloWorld app for Google Glass using the provided GDK.

This is the whole code word, I'm trying to develop a way to program this. Compilation does not give any errors, but it works.

package leagueMatch;

import com.google.android.glass.timeline.LiveCard;
import com.google.android.glass.timeline.TimelineManager;
import com.luisdelarosa.helloglass.R;

import android.os.Bundle;
import android.os.IBinder;
import android.app.Activity;
import android.app.Service;
import android.content.Intent;
import android.graphics.Color;
import android.view.Menu;
import android.widget.RemoteViews;

public class MainActivity extends Service {
    String blue_team, purple_team, mvp, casters;
    int blue_kills, purple_kills;

    private LiveCard mLiveCard;
    private TimelineManager mTimelineManager;
    private RemoteViews mViews;

    private static final String TAG = "LeagueMatchInfo";
    private static final String LIVE_CARD_ID = "leaguematch";

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate();
        //mTimelineManager = xxxxxx;

        mViews.setTextViewText(blue_kills, "Lol, Let see if this works");
        mLiveCard = mTimelineManager.createLiveCard(LIVE_CARD_ID);
        mLiveCard.setViews(mViews);

        mLiveCard.setDirectRenderingEnabled(true);
        mLiveCard.publish(LiveCard.PublishMode.SILENT);
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        return true;
    }

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }    
}

Shouldn't it launch a map that says: “Lol, let's see if this works?”

+4
source share
2 answers

I created a Hello World project on GitHub.

Launch the app by typing “ ok glass, hello world ” or click on the Hello World map shown on the timeline.

The live map has an options menu with two options:

  • Say hi
  • Close application

, , .

+15

, . , LiveCard. onStartCommand . . , .

+2

All Articles