Search in sources :

Example 1 with TwitterHandle

use of com.androidquery.auth.TwitterHandle in project androidquery by androidquery.

the class AjaxAuthActivity method auth_unauth.

public void auth_unauth() {
    FacebookHandle fh = new FacebookHandle(this, APP_ID, "read_stream");
    fh.unauth();
    TwitterHandle th = new TwitterHandle(this, CONSUMER_KEY, CONSUMER_SECRET);
    th.unauth();
    showResult("Auth data cleared", null);
}
Also used : TwitterHandle(com.androidquery.auth.TwitterHandle) FacebookHandle(com.androidquery.auth.FacebookHandle)

Example 2 with TwitterHandle

use of com.androidquery.auth.TwitterHandle in project androidquery by androidquery.

the class AjaxAuthActivity method auth_twitter.

public void auth_twitter() {
    TwitterHandle handle = new TwitterHandle(this, CONSUMER_KEY, CONSUMER_SECRET);
    String url = "http://twitter.com/statuses/mentions.json";
    aq.auth(handle).progress(R.id.progress).ajax(url, JSONArray.class, this, "twitterCb");
}
Also used : TwitterHandle(com.androidquery.auth.TwitterHandle)

Example 3 with TwitterHandle

use of com.androidquery.auth.TwitterHandle in project androidquery by androidquery.

the class AjaxAuthActivity method auth_twitter_update.

public void auth_twitter_update() {
    TwitterHandle handle = new TwitterHandle(this, CONSUMER_KEY, CONSUMER_SECRET);
    //1/statuses/update.format
    //https://upload.twitter.com/1/statuses/update_with_media.format
    String url = "http://twitter.com/statuses/update.json";
    Map<String, String> params = new HashMap<String, String>();
    params.put("status", "Testing 123");
    aq.auth(handle).progress(R.id.progress).ajax(url, params, JSONObject.class, this, "twitterCb2");
}
Also used : HashMap(java.util.HashMap) TwitterHandle(com.androidquery.auth.TwitterHandle)

Example 4 with TwitterHandle

use of com.androidquery.auth.TwitterHandle in project androidquery by androidquery.

the class AjaxAuthActivity method auth_twitter_upload.

public void auth_twitter_upload() {
    File file = aq.getCachedFile(UPLOAD_IMAGE);
    if (file == null) {
        aq.cache(UPLOAD_IMAGE, 0);
        return;
    }
    AQUtility.debug("upload file:" + file.length());
    TwitterHandle handle = new TwitterHandle(this, CONSUMER_KEY, CONSUMER_SECRET);
    String url = "https://upload.twitter.com/1/statuses/update_with_media.json";
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("status", "Testing Status Update with AndroidQuery");
    params.put("media[]", file);
    aq.auth(handle).progress(R.id.progress).ajax(url, params, JSONObject.class, this, "twitterCb2");
}
Also used : HashMap(java.util.HashMap) TwitterHandle(com.androidquery.auth.TwitterHandle) JSONObject(org.json.JSONObject) File(java.io.File)

Example 5 with TwitterHandle

use of com.androidquery.auth.TwitterHandle in project androidquery by androidquery.

the class AjaxAuthActivity method auth_twitter_token.

public void auth_twitter_token() {
    TwitterHandle handle = new TwitterHandle(this, CONSUMER_KEY, CONSUMER_SECRET) {

        @Override
        protected void authenticated(String secret, String token) {
            showResult("secret:" + secret + " token:" + token, null);
        }
    };
    handle.authenticate(false);
}
Also used : TwitterHandle(com.androidquery.auth.TwitterHandle)

Aggregations

TwitterHandle (com.androidquery.auth.TwitterHandle)5 HashMap (java.util.HashMap)2 FacebookHandle (com.androidquery.auth.FacebookHandle)1 File (java.io.File)1 JSONObject (org.json.JSONObject)1