Android facebook sdk 4.2 open stories and maps

I am trying to share open graphic stories and locations for a fitness course using android android sdk flash version 4.2,

I would like to have something like this:

https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-xaf1/t39.2178-6/851557_504281972964839_1538874606_n.png

but the map is not displayed

basically my code looks like this:

    ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
    .putString("og:type", "fitness.course")
    .putString("og:title", "Sample Course")
    .putString("og:description", "This is a sample course.")
    .putInt("fitness:duration:value", 100)
    .putString("fitness:duration:units", "s")
    .putInt("fitness:distance:value", 12)
    .putString("fitness:distance:units", "km")
    .putInt("fitness:speed:value", 5)
    .putString("fitness:speed:units", "m/s");

    ArrayList<ShareOpenGraphObject> metrics = new ArrayList<ShareOpenGraphObject>();
    ShareOpenGraphObject.Builder metric1 = new ShareOpenGraphObject.Builder();
    String timestamp1 = dateFormat.format(new Date(realDateTime1));
    metric1.putDouble("fitness:metrics:location:latitude", latitude1);
    metric1.putDouble("fitness:metrics:location:longitude",longitude1);
    metric1.putString("fitness:metrics:timestamp",timestamp1);
    metrics.add(metric1.build());
    ShareOpenGraphObject.Builder metric2 = new ShareOpenGraphObject.Builder();
    String timestamp2 = dateFormat.format(new Date(realDateTime2));
    metric2.putDouble("fitness:metrics:location:latitude", latitude2);
    metric2.putDouble("fitness:metrics:location:longitude",longitude2);
    metric2.putString("fitness:metrics:timestamp",timestamp2);
    metrics.add(metric2.build());

    .....

    object.putObjectArrayList("fitness:metrics", metrics);

    ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
     .setActionType("fitness.runs")
     .putObject("fitness:course", object.build())
     .putString("fitness:start_time", startTime)
     .putString("fitness:end_time", endTime)
     .build();

    ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
     .setPreviewPropertyName("fitness:course")
     .setAction(action)
     .build();

      

I've made several attempts without success, for example if I don't use the metrics array shown above and I put fitness: metrics: location: * directly on the original builder object, the map is rendered with one location. Hints?

+3


source to share


1 answer


I had a similar problem, in my case I had a web server that was hosting a fitness course and I solved it by setting the URL of the fitness course in ShareOpenGrapAction.

In the web backend, a fitness course is created using the link given here: https://developers.facebook.com/docs/opengraph/guides/fitness

In the application

ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
        .setActionType("fitness.runs")
        .putString("fitness:course", url)
        .build();

ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
        .setPreviewPropertyName("fitness:course")
        .setAction(action)
        .build();

      



Than call show

if (shareDialog.canShow(ShareOpenGraphContent.class)) {
    shareDialog.show(content);
}

      

Hope this helps!

+1


source







All Articles