5

I'm not able to insert a card into the user timeline using the GDK. My code is very simple :

TimelineManager timelineManager = TimelineManager.from(this);

Card card = new Card(this);
card.setText("Text").setInfo("Info").addImage(R.drawable.ic_launcher);
timelineManager.insert(card);

The issue returned by the insert method is the following :

Caused by: java.lang.IllegalArgumentException: Unknown URL content://com.google.android.glass.timeline/past_timeline_table

Is anyone also having this issue?

Julien

Jul
  • 1,039
  • 3
  • 12
  • 20
  • Is not clear. What is the error message ? – fabrizioM Nov 21 '13 at 11:35
  • Sorry, I made a mistake, I edited the question – Jul Nov 21 '13 at 13:29
  • 6
    From the GDK documentation: "This is a sneak peak of the GDK APIs. There are some APIs in the GDK add-on that are not documented in this reference documentation, because they do not currently work. You will see the APIs in the JAR file or in your IDE's autocomplete feature, but if they do not appear in here, they are currently not supported." (https://developers.google.com/glass/develop/gdk/reference/index) – Tony Allevato Nov 21 '13 at 15:57
  • In official Glass apps they use a TimelineProvider, but that API it's not included yet in the GDK. If you make the query getContentResolver().query(Uri.parse("content://com.google.glass.timeline/timeline"), null, null, null, null); you can find all the cards in your timeline, but I don't know yet how to insert them – Racker Dec 05 '13 at 09:43
  • 1
    XE12 brings the feature :) https://developers.google.com/glass/develop/gdk/ui/static-cards – Jul Dec 17 '13 at 22:31
  • XE16 - TimelineManager Class was remove. Changes to TimelineManager: The TimelineManager class and support for static cards from the GDK have been removed. – kimo May 10 '14 at 14:36

3 Answers3

1

This feature was added in XE12 / release 2 of the GDK.

Note that setInfo() is now setFootnote().

squidpickles
  • 1,737
  • 19
  • 27
0

Where are you trying to insert the card from? If you are still having trouble you can checkout my Hello Glass repo; I was able to create and display cards without issue: https://github.com/DasCody/Hello-Glass

Here is an example:

package com.codyengel.helloglass;

import com.google.android.glass.app.Card;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;

public class Magic extends Activity {

        @Override
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                /*
                 * We're creating a card for the interface.
                 * 
                 * More info here: http://developer.android.com/guide/topics/ui/themes.html
                 */
                Card card1 = new Card(this);
                card1.setText("Hello, Sir!");
                card1.setInfo("..or Ma'am");
                View card1View = card1.toView();

                // Display the card we just created
                setContentView(card1View);
        }

}
CodyEngel
  • 1,501
  • 14
  • 22
0

The best you can do at the moment ist look at the GDK Sample Projects. (File -> New -> Other -> Android Sample Project -> Choose GDK Sneak Peak as Build Target)
Have a close look at the Compass, Stopwatch and Timer examples and let them run on your glass.

Here is a code snippet (just the relevant code) how they create a new Card in the timeline in the Timer example:

TimelineManager mTimelineManager;
LiveCard mLiveCard;
TimerDrawer mTimerDrawer;

mLiveCard = mTimelineManager.getLiveCard(LIVE_CARD_ID);
mLiveCard.enableDirectRendering(true).getSurfaceHolder().addCallback(mTimerDrawer);
mLiveCard.setNonSilent(true);

Intent menuIntent = new Intent(this, MenuActivity.class);
mLiveCard.setAction(PendingIntent.getActivity(this, 0, menuIntent, 0));
mLiveCard.publish();

Short explanation:
a LiveCard is a Card you draw on. (potentially quite frequent)
TimerDrawer is a custom class that does the drawing.
getLiveCard creates a new Card in the timeline with the given string ID.
MenuActivity is a custom activity that is issued when you tap the LiveCard. (has to always be defined)

So basically this code creates a new Card, defines how to draw it, defines what happens when it is tapped and publishes it. There's much more code involved, look at the sample. Hope this guides you in the right direction.