Media upload action

Media upload action is called when user upload image or video. This action can provides other media uploader to user.

Flow

  1. Image/video is selected by user.

  2. Upload button is pressed by user.

  3. Start this action by twicca.

    twicca starts action with this intent.

    Type Value
    Action jp.r246.twicca.ACTION_UPLOAD
    Category android.intent.category.DEFAULT
    Data (Content URI that is image/video selected by user)
    Extra Name Value Data type
    android.intent.extra.TEXT Message that is user inputted when press upload button. String
    jp.r246.twicca.USER_SCREEN_NAME User screen name(without "@") String
    latitude Latitude(optional) String
    longitude longitude(optional) String
    in_reply_to_status_id in_reply_to_status_id(optional) String
  4. Your app/plug-in is launched by receiving this action.

    When your plug-in support only image, you should describe "image/*" in Intent-Filter. When your plug-in support only video, you should describe "video/*" in Intent-Filter. When your plug-in support only specified media type, you should describe MIME type in Intent-Filter.(ex. JPEG = "image/jpeg")

    IMPORTANT: Security TIPS

    This action often upload media in SD card to internet. In order to prevent your app/plug-in is used by a malicious application, to limit the receipt of intent is recommended.

    @Override
    public void onCreate(Bundle savedInstanceState) {
    	superonCreate(savedInstanceState);
    	ComponentName cn = getCallingActivity();
    	if( cn == null ){
    		// Called with Activity#startActivity( Intent intent )
    		// twicca start this action with Activity#startActivityForResult( Intent intent, int requestCode ) 
    		finish();
    		return
    	}
    	
    	if( !"jp.r246.twicca".equals( cn.getPackageName() ) ){
    		// Called from other app.
    		finish();
    		return
    	}
    }
  5. Your app/plug-in uploads image/video to uploader and receive image URL.

  6. Your app/plug-in return result and image URL to twicca.

    If upload process is success, your app/plug-in must be setResult( this intent, RESULT_OK ) and finish().

    Type Value
    Data (Media URI of uploaded media)

    If upload process is failure, your app/plug-in must be nothing and finish.

  7. If twicca receive RESULT_OK, twicca insert image URL to text box in editing tweet.