Express Mobile SDK Usage instructions

Source: Internet
Author: User
Tags save file

The Express SDK originates from the Express download kernel, while maintaining ultra-low resource usage at high speed downloads. At the same time provide comprehensive download task management, greatly reduce the download development work.

Accelerated throttling
· P2S technology, Multi-source concurrent download, help you reduce the main source traffic
· Power-on or off-peer, balanced throttling and user experience for individual tasks
· Enable or disable the peer-to-peer module at any time without worrying about user power and traffic

Complete Download Management
· Provide task List management
· Provides task add, delete, pause, resume operation, perfect support for breakpoint continuation and file check
· Support to set the number of concurrent tasks, support task queuing mechanism
· Download ZIP data to provide fast decompression function

Free acceleration
· Free acceleration for SDK user data with Express cloud resources

Streamline the mobile kernel
· Ultra-Thin download kernel, dedicated to provide download service
· Ultra-low resource occupancy, stable and efficient
· Multi-source Download, optional peer-to, breakpoint continuation, multi-task management, to meet your various download needs



Get the FlashGet SDK

In order to integrate the Flashget SDK, you first need to register with the Flashget SDK official website and create the app, get the Appkey of the Flashget SDK, and then go to the download page of the SDK Download the SDK Compression Package , unzip the directory structure can be obtained as follows:

Armeabi: Copy the file directly to the target Project Libs directory.

Com.flashget: Create a new Com.flashget package under Target project src , copy com.flaget File under folder to new package

Flashgetexamole:demo files, directly add existing projects to run. (UTF-8 format)

Doc: Description Document

Configure Androidmanifest.xml

First you need to add the following list of permissions:

<!--Get permissions on the network--

< uses-permission android:name="Android.permission.INTERNET"/>

<!--Write external storage permissions--

< uses-permission android:name="Android.permission.WRITE_EXTERNAL_STORAGE" />

<!--read external storage permissions--

< uses-permission android:name="Android.permission.READ_EXTERNAL_STORAGE" />

These permissions will allow your project and FlashGet SDK to get permission to connect to the network, gain access to the network status of your device, enable HTTPS secure connections, read the status of mobile devices, and save the necessary configuration permissions. In general, even if the FlashGet SDK is not integrated, most projects will register for these permissions.

Then you need to add the Appkey for the app assignment:

<!--value: Add Appkey for App assignment

< Meta-data

android:name="Flashget_appkey"

android:value=" your appKey" >

</ Meta-data >

Add code

The Integrated FlashGet SDK requires at least two places to add code, including:

1) Open your project's entry activity and insert the following code in its oncreate:

String AppKey = Downloadutil.getappkey (Getapplicationcontext ());

Downloadutil. Downloader = new downloader ();

Downloadutil. taskinfo = new downloadtaskinfo ();

int test = downloadutil. Downloader. Init (AppKey, Downloadutil. Data_path);

This line of code initializes the FlashGet SDK, after which the operations on the FlashGet SDK are sequentially based. If this line of code is not called before all FlashGet SDK operations, a null pointer exception is thrown.

2) Insert the following code in the first line of the OnDestroy method of your project's export activity:

Downloadutil. Downloader. UnInit ();

This line of code frees up resources.

INITSDK can be called repeatedly, in fact the FlashGet SDK recommends that you call this method when you are unsure to ensure that the FlashGet SDK is initialized correctly. Once the STOPSDK is called, the INITSDK must be recalled to use the functionality of the FlashGet SDK, or a null pointer exception will occur.

The following is an introduction to the FlashGet SD method using

1) Initialize the FlashGet SDK:

 /**

     *  Initialize

     * string strappkey: Key obtained at the time of registration

     * strconfigdir: Configuration file directory

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;*&NBSP;&NBSP; @return

     */

    public  native  int  init (string strappkey, string strconfigdir);

2) Add Download task

/**

* Add Download Task

* Parameters: strURL: Download link, Strdir: Save directory, StrName: Save file name

     *  @return : Ntaskid: Unique ID for each download task

*/

Public native int AddTask (String strurl, String Strdir, string strName);

3) Start Download task

  /**

     *  start download task

     * ntaskid:addtask ()

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;*&NBSP;&NBSP; @ return

      */

    public  native  int  starttask (int  ntaskid);

Note: First click on the download must first call AddTask (), and then call StartTask (int ntaskid);

Pause and restart the download only need to call StartTask (int ntaskid);

4) Pause Download task

/**

* Pause Download Task

* Return value of Ntaskid:addtask ()

     *  @return : See error code

*/

Public native int Pausetask (int ntaskid);

5) Get task status

/**

* Get task status

* strURL: Download link

* Return value: See Task status

*/

Public native int Gettaskinfo (int ntaskid, downloadtaskinfo taskinfo);

6) Delete Download task

/**

* Get task status

* strURL: Download link

* Return value: See Task status

*/

Public native int Gettaskinfo (int ntaskid, downloadtaskinfo taskinfo);

7) Get the Incomplete download task List

/**

* Get incomplete Download Task List

     *   @return : Ntaskid of download task not completed

*/

Public native Arraylist<integer> Getuncompletedtaskids ();

8) Get the Download complete task List

/**

* Get a list of downloaded completed tasks

     *  @return : Ntaskid of download task not completed

*/

Public native Arraylist<integer> Getcompletedtaskids ();

9) Use to release resources when exiting the program

/**

* Use to release resources when exiting the program

     *   @return : See error code

*/

Public native int UnInit ();

10) Set the maximum number of tasks to download simultaneously (default of 2)

/**

* Set the maximum number of tasks to download at the same time (default of 2)

* No limit on number of settings

     *   @return : See error code

*/

Public native int Setmaxdownloadingtaskcount (int ncount);

Click to open link

11) Toggle Debug mode on/off

/**

* Toggle Debug mode on/off

     *  @return : See error code

*/

Public native int Setdebugmode (boolean bsetdebug);

12) Unzip the file

 /**

     *  unzip the file

     * strsrcfile: Compressed absolute path

     * strdir: Directory after decompression

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;*&NBSP;&NBSP; @return : Task failure code

     */

    public   native  int   Unzipfile (String strsrcfile, string strdir);

Note: More details can be downloaded in the compressed package has a detailed use of the document:: Http://sdk.flashget.com/down/flashget_SDK1.0.zip


Express Mobile SDK Usage instructions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.