Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature may not be available in some browsers.
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpState;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.params.HttpClientParams;
import com.google.code.facebookapi.Attachment;
import com.google.code.facebookapi.AttachmentMediaImage;
import com.google.code.facebookapi.FacebookException;
import com.google.code.facebookapi.FacebookJsonRestClient;
import com.google.code.facebookapi.FeedFacebookPhoto;
import com.google.code.facebookapi.Permission;
import com.google.code.facebookapi.TemplatizedAction;
public class FB_Test {
public static void main (String a[]) throws FacebookException{
FB_Test sfb=new FB_Test();
sfb.send("From My App: publish steven on facebook");
}
public void send(String message)throws FacebookException{
String FB_APP_API_KEY = new String("");
String FB_APP_SECRET = new String("");
String FB_SESSION_KEY = new String("PROBLEM HERE I THINK");
FacebookJsonRestClient facebook = new FacebookJsonRestClient( FB_APP_API_KEY, FB_APP_SECRET, FB_SESSION_KEY );
//FacebookJsonRestClient facebookClient2 = (FacebookJsonRestClient)facebook.getFacebookRestClient();
FacebookJsonRestClient facebookClient = (FacebookJsonRestClient)facebook;
facebookClient.stream_publish(message, null, null, null, null);
System.out.println("successfully updated");
}
}
!!! Das hier ist mein Ansatz, komme aber nicht weiter 🙁
jo muss er - er muss zulassen, dass deine App posts an seine Pinwannd sendet3. Ich gehe davon aus, dass du den User (oder die App) zuerst registrieren musst, um den Session Key zu erhalten
auch das richtig.4. Du musst dies AFAIK bei FB als App angemeldet haben, um eine Verbindung herzustellen (siehe API und Secret Key)
URL url = new URL (urlS);
URLConnection yc = url.openConnection ();
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.URL;
import java.net.URLConnection;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpState;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.params.HttpClientParams;
import com.google.code.facebookapi.Attachment;
import com.google.code.facebookapi.AttachmentMediaImage;
import com.google.code.facebookapi.FacebookException;
import com.google.code.facebookapi.FacebookJaxbRestClient;
import com.google.code.facebookapi.FacebookJsonRestClient;
import com.google.code.facebookapi.FeedFacebookPhoto;
import com.google.code.facebookapi.Permission;
import com.google.code.facebookapi.TemplatizedAction;
import com.restfb.DefaultFacebookClient;
import com.restfb.FacebookClient;
import com.restfb.types.Page;
import com.restfb.types.User;
public class FacebookConnect
{
public static void main (String a[]) throws FacebookException{
FacebookConnect sfb=new FacebookConnect();
sfb.send("From My App: publish steven on facebook");
}
public void send(String message)throws FacebookException{
String FB_APP_API_KEY = new String("");
String FB_APP_SECRET = new String("6");
//FacebookJaxbRestClient client = new FacebookJaxbRestClient( FB_APP_API_KEY, FB_APP_SECRET );
System.getProperties().put("http.proxyHost", "");
System.getProperties().put("http.proxyPort", "");
System.getProperties().put("https.proxyHost", "");
System.getProperties().put("https.proxyPort", "");
try
{
FacebookClient fb = new DefaultFacebookClient("");
//facebookClient.
/*
System.err.println(token);
String urlS = "http://www.facebook.com/login.php?api_key="
+ FB_APP_API_KEY + "&v=1.0"
+ "&auth_token=" + token;
URL url = new URL (urlS);
URLConnection yc = url.openConnection ();
BufferedReader in = new BufferedReader (new InputStreamReader (
yc.getInputStream ()));
String eingabezeile;
while ((eingabezeile = in.readLine ()) != null)
{
sb.append(eingabezeile).append("\n");
}
in.close ();
System.err.println(sb.toString());
String sessionKey = client.auth_getSession( token );
String sessionKey1 = client.auth_getSession( token );
System.out.println("dfdf");
// obtain temp secret
String tempSecret = client.getSecret();
// new facebook client object
client = new FacebookJaxbRestClient( FB_APP_API_KEY, tempSecret, sessionKey );
System.out.println("Session key is " + sessionKey );
*/
}
catch( Exception e )
{
e.printStackTrace();
}
//FacebookJsonRestClient facebookClient2 = (FacebookJsonRestClient)facebook.getFacebookRestClient();
//FacebookJsonRestClient facebookClient = (FacebookJsonRestClient)facebook;
//facebookClient.stream_publish(message, null, null, null, null);
}
}
verbinde(erfolgsfunktion, misserfolgsfunktion)