Note that there are some explanatory texts on larger screens.

plurals
  1. POCould'nt Post a video on Twitter using android
    text
    copied!<p>I want to post a video on twitter from my android phone but I got and error and don't know how to solve this error I really need your help because I am new in android development...</p> <p>here is my code to upload video using android os :-</p> <pre><code>btnuploadvideo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Uri video = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.test); postToTwitvid(video.getPath()); } }); private void postToTwitvid(String videoPath){ String access_token = mSharedPreferences.getString(PREF_KEY_OAUTH_TOKEN, ""); // Access Token Secret String access_token_secret = mSharedPreferences.getString(PREF_KEY_OAUTH_SECRET, ""); AccessToken token = new AccessToken(access_token, access_token_secret); Values values = new Values(); values.setSession(new Session()); TwitvidApi api = new TwitvidApi(values); api.setSecureUrlEnabled(false); Session session; try { session = api.authenticate(new TwitterAuthPack.Builder() .setConsumerKey(TWITTER_CONSUMER_KEY) .setConsumerSecret(TWITTER_CONSUMER_SECRET) .setOAuthToken(token.getToken()) .setOAuthTokenSecret(token.getTokenSecret()) .build()); api.getValues().setSession(session); final UploadHelper helper = new UploadHelper(api); File file=new File(videoPath); TwitvidPost twitvidPost = new TwitvidPost.Builder() .setFile(file).setChunkSize(10485760) .setMessage("Twitvid test") .setPostToTwitter(true) .create(); try { if (helper.upload(twitvidPost)) { Toast.makeText(MainActivity.this, "Posted on Twitter and Twitvid", Toast.LENGTH_LONG).show(); } else { Toast.makeText(MainActivity.this, "Post failed", Toast.LENGTH_LONG).show(); } } catch (Exception e) { e.printStackTrace(); } } catch (ApiException e1) { e1.printStackTrace(); } } </code></pre> <p>And log cat is :-</p> <pre><code>07-26 20:18:06.549: W/System.err(639): Exception[java.lang.RuntimeException: A Twitvid API error occurred, ErrorResponse{code=1001, message='Couldn't authenticate via Telly API (Invalid Auth request)'}] 07-26 20:18:06.549: W/System.err(639): at com.twitvid.api.TwitvidApi.getJsonResponse(TwitvidApi.java:313) 07-26 20:18:06.549: W/System.err(639): at com.twitvid.api.TwitvidApi.authenticate(TwitvidApi.java:29) 07-26 20:18:06.549: W/System.err(639): at com.example.twitterintrgration.MainActivity.postToTwitvid(MainActivity.java:393) 07-26 20:18:06.549: W/System.err(639): at com.example.twitterintrgration.MainActivity.access$3(MainActivity.java:379) 07-26 20:18:06.559: W/System.err(639): at com.example.twitterintrgration.MainActivity$4.onClick(MainActivity.java:231) 07-26 20:18:06.559: W/System.err(639): at android.view.View.performClick(View.java:2485) 07-26 20:18:06.559: W/System.err(639): at android.view.View$PerformClick.run(View.java:9080) 07-26 20:18:06.559: W/System.err(639): at android.os.Handler.handleCallback(Handler.java:587) 07-26 20:18:06.559: W/System.err(639): at android.os.Handler.dispatchMessage(Handler.java:92) 07-26 20:18:06.569: W/System.err(639): at android.os.Looper.loop(Looper.java:123) 07-26 20:18:06.569: W/System.err(639): at android.app.ActivityThread.main(ActivityThread.java:3683) 07-26 20:18:06.569: W/System.err(639): at java.lang.reflect.Method.invokeNative(Native Method) 07-26 20:18:06.569: W/System.err(639): at java.lang.reflect.Method.invoke(Method.java:507) 07-26 20:18:06.569: W/System.err(639): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 07-26 20:18:06.569: W/System.err(639): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 07-26 20:18:06.569: W/System.err(639): at dalvik.system.NativeStart.main(Native Method) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload