守望者--AIR技术交流

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
热搜: ANE FlasCC 炼金术
查看: 1850|回复: 0
打印 上一主题 下一主题

iOS与后台通信/上传/下载ANE

[复制链接]
  • TA的每日心情
    擦汗
    2018-4-10 15:18
  • 签到天数: 447 天

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

    Rank: 18Rank: 18Rank: 18Rank: 18Rank: 18

    威望
    562
    贡献
    29
    金币
    52694
    钢镚
    1422

    开源英雄守望者

    跳转到指定楼层
    楼主
    发表于 2015-1-29 17:49:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    应用下载
    应用名称: BackgroundTransfer-ANE
    支持64位: 支持
    当前版本: 1.1
    运行平台: IOS 
    开发语言: ActionScript 3 其他 
    应用类别: ANE-C/C++
    应用简介: Adobe AIR native extension to use iOS Background Transfer Service in AIR application.
    本帖最后由 破晓 于 2015-4-9 09:37 编辑

    Background Transfer - Adobe AIR Native Extension for iOS

    This AIR Native Extension provides AS3 API to use iOS Background Transfer Service for downloading files in Adobe AIR application.

    Starting from iOS7, with Background Transfer Service:

    • downloads and uploads are managed by iOS;
    • the transfer continues even when the user sends the app to the background (e.g. switches to another app);
    • there's no time limit for download/upload;
    • if the app crashes during the download/upload, the retransmission will start automatically when the app is launched;

    Read more about NSURLSession in Apple documentation:

    https://developer.apple.com/library/IOs/documentation/Foundation/Reference/NSURLSession_class/index.html

    Read more about multitasking in iOS:

    NSURLSession and Background Transfer Service


    Usage

    Initialize BackgroundTransfer object:


    1. <font color="rgb(51, 51, 51)">BackgroundTransfer.instance.initializeSession(SESSION_ID);

    2. downloadTask = BackgroundTransfer.instance.createDownloadTask(sessionID, remoteURL, localPath);
    3. downloadTask.addEventListener(ProgressEvent.PROGRESS, onDownloadTaskProgress, false, 0, true);
    4. downloadTask.addEventListener(Event.COMPLETE, onDownloadTaskCompleted, false, 0, true);
    5. downloadTask.addEventListener(ErrorEvent.ERROR, onDownloadTaskError, false, 0, true);
    6. downloadTask.resume();</font>
    复制代码
    To continue download tasks that were interrupted (for instance, due to app crash) implement initialization event:
    1. BackgroundTransfer.instance.addEventListener(BTSessionInitializedEvent.INITIALIZED, onBackgroundSessionInitialized, false, 0, true);

    2. private function onBackgroundSessionInitialized(event:BTSessionInitializedEvent):void {
    3.     for each (var runningTask:BTDownloadTask in event.runningTasks) {
    4.         // continue tasks
    5.     }
    6. }
    复制代码
    Run the demo project for more implementation details.

    Limitations
    Upload tasks are not supported and currently I'm not working on it. Pull requests are welcome . There's no support for Android platform.

    Building
    Requirements – Adobe Air SDK 4.0 or later, Xcode, iOS SDK 7.0 or laterAdd the FlashRuntimeExtensions.h file from the Adobe AIR SDK to theios/BackgroundTransferANE/BackgroundTransferANE folder in the project. Update the build/ant-build.config file in the build folder to match your Adobe AIR SDK setup. Run the ant build script ant-build.xml. This will compile and package the ANE. Binary files will be saved into bin/ folder.

    License
    Default (not native) implementation of this ANE uses GreenSock LoaderMax for downloading files.greensock.swc library is subject to its own license.
    Please follow https://greensock.com/licensing/ for more details.
    The MIT License (MIT)Copyright (c) 2014 Maciek GrzybowskiPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.





    相关链接:

    https://github.com/ncreated/BackgroundTransfer-ANE

    提示:作者在两个月前更新了64位版本,请点击此处下载最新版本


    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有帐号?立即注册

    x
    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
    收藏收藏 分享分享 支持支持 反对反对 微信
    守望者AIR技术交流社区(www.airmyth.com)
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    
    关闭

    站长推荐上一条 /4 下一条

    QQ|手机版|Archiver|网站地图|小黑屋|守望者 ( 京ICP备14061876号

    GMT+8, 2024-4-20 08:40 , Processed in 0.053716 second(s), 39 queries .

    守望者AIR

    守望者AIR技术交流社区

    本站成立于 2014年12月31日

    快速回复 返回顶部 返回列表