Bonsoir,
Je veux fonctionner twitter à partir de mon application Android. J'ai utilisé ce code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import java.io.InputStream;
import java.util.Properties;

import com.oreilly.android.otweet.R;

import twitter4j.Twitter;
import twitter4j.http.AccessToken;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class OAuthHelper {

  private static final String APPLICATION_PREFERENCES = "app_prefs";
  private static final String AUTH_KEY = "auth_key";
  private static final String AUTH_SEKRET_KEY = "auth_secret_key";
  private SharedPreferences prefs;
  private AccessToken accessToken;
  private String consumerSecretKey;
  private String consumerKey;
  private Context context;

  public OAuthHelper(Context context) {
    this.context = context;
    prefs = context.getSharedPreferences(APPLICATION_PREFERENCES, Context.MODE_PRIVATE);
    loadConsumerKeys();
    accessToken = loadAccessToken();
  }

  public void configureOAuth(Twitter twitter) {
    twitter.setOAuthConsumer(consumerKey, consumerSecretKey);
    twitter.setOAuthAccessToken(accessToken);
  }

  public boolean hasAccessToken() {
    return null != accessToken;
  }

  public void storeAccessToken(AccessToken accessToken) {
    Editor editor = prefs.edit();
    editor.putString(AUTH_KEY, accessToken.getToken());
    editor.putString(AUTH_SEKRET_KEY, accessToken.getTokenSecret());
    editor.commit();
    this.accessToken = accessToken;
  }

  private AccessToken loadAccessToken() {
    String token = prefs.getString(AUTH_KEY, null);
    String tokenSecret = prefs.getString(AUTH_SEKRET_KEY, null);
    if (null != token && null != tokenSecret) {
      return new AccessToken(token, tokenSecret);
    } else {
      return null;
    }
  }

  private void loadConsumerKeys() {
    try {
      Properties props = new Properties();
      InputStream stream = context.getResources().openRawResource(R.raw.oauth);
      props.load(stream);
      consumerKey = (String)props.get("consumer_key");
      consumerSecretKey = (String)props.get("consumer_secret_key");
    } catch (Exception e) {
      throw new RuntimeException("Unable to load consumer keys from oauth.properties", e);
    }
  }
}
J'ai fait l'enregistrement de mon application. J'ai récupéré tous les clés mais je n'ai pas trouvé clé de APPLICATION_PREFERENCES = "app_prefs";
Où je peux trouver cetté clé?