android - facebook open graph dialog is not displayed -


i trying implement open graph dialog using sdk version 4.2.0.

i updated manifest :

 <activity android:name="com.facebook.facebookactivity"           android:configchanges="keyboard|keyboardhidden|screenlayout|screensize|orientation"           android:theme="@android:style/theme.translucent.notitlebar"           android:label="@string/app_name" />        <provider android:authorities="com.facebook.app.facebookcontentprovider//my app id//"           android:name="com.facebook.facebookcontentprovider"            android:exported="true" />  

i initiate sdk in first activity : facebooksdk.sdkinitialize(getapplicationcontext());

i prepare open graph actions , objects :

shareopengraphobject fbroute = new shareopengraphobject.builder() .putstring("og:type", "me/objects/fbclimbmystats:route") .putstring("og:title", "") .putstring("name", name) .putstring("grade", grade.getdisplayablegrade(pprefs, type)) .putstring("location", spotname) .build();     shareopengraphaction action = new shareopengraphaction.builder() .setactiontype("route.climb") .putobject("route", fbroute) .build();  shareopengraphcontent content = new shareopengraphcontent.builder() .setpreviewpropertyname("route") .setaction(action) .build(); 

and display : sharedialog.show(this, content);

my problem dialog not displayed. not second , log cat not give information.

additional info: - havent been through process of approving app on facebook yet (i can't figure how either...). should start that?

what else did miss?

thanks guys.

so solved problem , here code lessons learned.

my manifest:

 <activity android:name="com.facebook.facebookactivity"       android:configchanges="keyboard|keyboardhidden|screenlayout|screensize|orientation"       android:theme="@android:style/theme.translucent.notitlebar"       android:label="@string/app_name" />      <meta-data android:name="com.facebook.sdk.applicationid" android:value="@string/facebook_app_id"/>     <meta-data android:name="com.facebook.sdk.applicationname"                android:value="@string/facebook_app_name" />      <provider android:authorities="com.facebook.app.facebookcontentprovider{facebook_app_id}"       android:name="com.facebook.facebookcontentprovider"        android:exported="true" />  

my code generate open graph object:

//create opengraph object , set attributes route shareopengraphobject.builder fbroutebuilder = new shareopengraphobject.builder(); fbroutebuilder.putstring("og:type", "fbclimbmystats:route"); // keep ":"  //the route title  string fbtitle = name!= null && !name.isempty() ? name : "congrats"; fbroutebuilder.putstring("og:title", fbtitle);  //the route name if (name!=null && !name.isempty())     fbroutebuilder.putstring("route:name", "le nom");  //the route grade. route have grade fbroutebuilder.putstring("route:grade", grade.getdisplayablegrade(pprefs, type));  //the location have name fbroutebuilder.putstring("route:location", spotname);  shareopengraphobject fbroute = fbroutebuilder.build();   

then action:

//we build action climb object juste created above shareopengraphaction.builder actionbuilder = new shareopengraphaction.builder();  switch (completion){ case route.completion_on_sight:     actionbuilder.setactiontype("fbclimbmystats:on_sight"); //name space needed     break; case route.completion_flash:     actionbuilder.setactiontype("fbclimbmystats:flash");     break; default :     actionbuilder.setactiontype("fbclimbmystats:climb"); }  actionbuilder.putobject("route", fbroute);  shareopengraphaction action = actionbuilder.build(); 

and content object :

shareopengraphcontent.builder contentbuilder = new shareopengraphcontent.builder();     contentbuilder.setpreviewpropertyname("route"); // no namespace here     contentbuilder.setaction(action);     shareopengraphcontent content =  contentbuilder.build(); 

here bit of knowledge acquired through trial , error:

  • do not give attributes if not used in sentence in graph.
  • do not give empty attributes (pass null string)
  • the attribute "namespace.object" incorrect. use "namespace:object"
  • for custom attributes of object, call them using "object:attribute"

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -