How to upload video from url to backgorund (Android), e.g. vimeo app

I am new to android, I am developing one application for video streaming, but I am stuck in downloading videos in the application, I want to download the video in the background just like the vimeo application in the vimeo application, if you want to download the video, it will start downloading a video on another screen (loading screen) in the background, if you go to the loading screen, it has already started downloading the video, another thing is that if you go through the application, it will still load the video in the background on the screen downloads and when you go to the screen On download, it will show you the updated download progress.

1) To upload video to vimeo enter image description here

2) Screen loading enter image description here

Please give me a suggestion about the download manager.

Thanks in advance

+4
3

Vimeo open-sourcing. , . "" , :

android-priority-jobqueue

tape

robospice

, Vimeo, . , .

+1

SD-

package com.Video.ALLTestProject;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Environment;
import android.util.Log;

public class VideoSaveSDCARD extends Activity {

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        ProgressBack PB = new ProgressBack();
        PB.execute("");
    }

    class ProgressBack extends AsyncTask < String, String, String > {
        ProgressDialog PD;
        @Override
        protected void onPreExecute() {
            PD = ProgressDialog.show(LoginPage.this, null, "Please Wait ...", true);
            PD.setCancelable(true);
        }
        @Override
        protected void doInBackground(String...arg0) {
            DownloadFile("http://beta-vidizmo.com/hilton.mp4", "Sample.mp4");
        }
        protected void onPostExecute(Boolean result) {
            PD.dismiss();
        }
    }
}

SD-?

0

1)

Android Download Manager Android 2.3 .

Download Manger HTTP- . Download.

, , , .

getSystemService (String), DOWNLOAD_SERVICE.

, API, ACTION_NOTIFICATION_CLICKED, , .

2) Foreground

- , , , , , , ​​. , "", , , ​​ .

, , . .

To request the launch of your service in the foreground, call startForeground (). This method takes two parameters: an integer that uniquely identifies the notification and the notification for the status bar.

For instance:

Notification notification = new Notification(R.drawable.icon,     getText(R.string.ticker_text),
    System.currentTimeMillis());
Intent notificationIntent = new Intent(this, ExampleActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,     notificationIntent, 0);
notification.setLatestEventInfo(this, getText(R.string.notification_title),
    getText(R.string.notification_message), pendingIntent);
startForeground(ONGOING_NOTIFICATION_ID, notification);

To remove a service from the foreground, call the stopForeground () function. This method takes a boolean value, indicating whether the status bar notification should also be deleted. This method does not stop the service. However, if you stop the service

0
source

Source: https://habr.com/ru/post/1649767/


All Articles