请选择 进入手机版 | 继续访问电脑版
12下一页
返回列表 发新帖

[模块使用] amap

[复制链接]
龙毅257 发表于 2022-5-11 17:43:33
本帖最后由 龙毅257 于 2022-5-14 09:22 编辑

downloadRegion
启动下载指定 adcode 区域的离线地图,无需调用 open 接口
downloadRegion({params}, callback(ret, err))
params
adcode:
  • 类型:字符串
  • 描述:指定的区域的 adcode 码(在android平台使用区域的cityCode)
shouldContinueWhenAppEntersBackground:
  • 类型:布尔
  • 描述:(可选项)进入后台是否允许继续下载
  • 默认:false
callback(ret)
ret:
  • 类型:JSON 对象
  • 内部字段:
{    status: 0,           //数字类型;取值范围如下:                         // 0:以插入队列,等待中                         // 1:开始下载                         // 2:下载过程中                         // 3:下载成功                         // 4:取消                         // 5:解压缩                         // 6:全部顺利完成                         // 7:发生错误     info: {              //JSON对象;离线包信息,仅当 status 为2时有值        expectedSize: ,  //数字类型;离线包大小,单位:byte        receivedSize:    //数字类型;已下载到本地离线包大小,单位:byte    }              }示例代码var aMap = api.require('aMap');aMap.downloadRegion({    adcode: '110000',    shouldContinueWhenAppEntersBackground: true}, function(ret) {});    function fnDownloadRegion() {
        var aMap = api.require('aMap');
        aMap.downloadRegion({

            adcode: '110000',
            shouldContinueWhenAppEntersBackground: true
        }, function (ret) { alert(JSON.stringify(ret)); });

    };

function fnDownloadRegion()在手机上测试和模拟器上测试没有alert(JSON.stringify(ret));,怎么获取返回的值?
file:///F:\QQ\1158842161\Image\C2C\D2DE0F0F3C762FE7E569875A9229E6D4.jpg



技术F,为什么我的没有返回值

Screenshot_20220514-091958.png
}8BDG3UHWW%IYON5[~W6C4S.png

12条回复

技术咨询-F 管理员 27137Y币
没返回值可能还没下载成功
龙毅257 马路杀手 676Y币
正在下载那个接口有提示,
技术支持-F · 2022-5-11 18:27没返回值可能还没下载成功
龙毅257 马路杀手 676Y币
下载是已经完成了的
技术支持-F · 2022-5-11 18:27没返回值可能还没下载成功
龙毅257 马路杀手 676Y币
而且下载失败他也要有提示啊,你看模块文档
技术支持-F · 2022-5-11 18:27没返回值可能还没下载成功
技术咨询-F 管理员 27137Y币
  1. [2022-5-12 17:14:32][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":0}} at amap2.html:930
  2. [2022-5-12 17:14:32][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":0}} at amap2.html:930
  3. [2022-5-12 17:14:32][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":0}} at amap2.html:930
  4. [2022-5-12 17:14:33][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":454224}} at amap2.html:930
  5. [2022-5-12 17:14:34][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":908449}} at amap2.html:930
  6. [2022-5-12 17:14:34][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":1589786}} at amap2.html:930
  7. [2022-5-12 17:14:35][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":2271123}} at amap2.html:930
  8. [2022-5-12 17:14:35][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":2725347}} at amap2.html:930
  9. [2022-5-12 17:14:36][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":3179572}} at amap2.html:930
  10. [2022-5-12 17:14:36][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":3860909}} at amap2.html:930
  11. [2022-5-12 17:14:37][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":4315133}} at amap2.html:930
  12. [2022-5-12 17:14:37][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":4769358}} at amap2.html:930
  13. [2022-5-12 17:14:38][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":5450695}} at amap2.html:930
  14. [2022-5-12 17:14:39][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":5904919}} at amap2.html:930
  15. [2022-5-12 17:14:39][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":6586256}} at amap2.html:930
  16. [2022-5-12 17:14:40][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":7267593}} at amap2.html:930
  17. [2022-5-12 17:14:40][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":7721818}} at amap2.html:930
  18. [2022-5-12 17:14:41][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":8403155}} at amap2.html:930
  19. [2022-5-12 17:14:41][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":8857379}} at amap2.html:930
  20. [2022-5-12 17:14:42][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":9538716}} at amap2.html:930
  21. [2022-5-12 17:14:42][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":9992941}} at amap2.html:930
  22. [2022-5-12 17:14:43][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":10674278}} at amap2.html:930
  23. [2022-5-12 17:14:43][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":11355615}} at amap2.html:930
  24. [2022-5-12 17:14:44][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":11809839}} at amap2.html:930
  25. [2022-5-12 17:14:44][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":12036951}} at amap2.html:930
  26. [2022-5-12 17:14:45][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":12491176}} at amap2.html:930
  27. [2022-5-12 17:14:45][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":12945401}} at amap2.html:930
  28. [2022-5-12 17:14:46][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":13172513}} at amap2.html:930
  29. [2022-5-12 17:14:47][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":13626738}} at amap2.html:930
  30. [2022-5-12 17:14:47][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":14080962}} at amap2.html:930
  31. [2022-5-12 17:14:48][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":14535187}} at amap2.html:930
  32. [2022-5-12 17:14:48][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":14989411}} at amap2.html:930
  33. [2022-5-12 17:14:49][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":15216524}} at amap2.html:930
  34. [2022-5-12 17:14:49][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":15443636}} at amap2.html:930
  35. [2022-5-12 17:14:50][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":15670748}} at amap2.html:930
  36. [2022-5-12 17:14:51][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":16124973}} at amap2.html:930
  37. [2022-5-12 17:14:51][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":16579197}} at amap2.html:930
  38. [2022-5-12 17:14:52][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":17033422}} at amap2.html:930
  39. [2022-5-12 17:14:52][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":17487647}} at amap2.html:930
  40. [2022-5-12 17:14:53][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":18168984}} at amap2.html:930
  41. [2022-5-12 17:14:53][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":18623208}} at amap2.html:930
  42. [2022-5-12 17:14:54][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":19077433}} at amap2.html:930
  43. [2022-5-12 17:14:54][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":19531657}} at amap2.html:930
  44. [2022-5-12 17:14:55][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":19985882}} at amap2.html:930
  45. [2022-5-12 17:14:55][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":20440107}} at amap2.html:930
  46. [2022-5-12 17:14:56][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":20894331}} at amap2.html:930
  47. [2022-5-12 17:14:57][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":21575668}} at amap2.html:930
  48. [2022-5-12 17:14:57][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":22029893}} at amap2.html:930
  49. [2022-5-12 17:14:58][INFO] {"status":2,"info":{"expectedSize":22711230,"receivedSize":22484117}} at amap2.html:930
  50. [2022-5-12 17:14:58][INFO] {"status":5,"info":{"expectedSize":22711230,"receivedSize":0}} at amap2.html:930
  51. [2022-5-12 17:14:58][INFO] {"status":5,"info":{"expectedSize":22711230,"receivedSize":0}} at amap2.html:930
  52. [2022-5-12 17:15:0][INFO] {"status":5,"info":{"expectedSize":22711230,"receivedSize":12945401}} at amap2.html:930
  53. [2022-5-12 17:15:0][INFO] {"status":6,"info":{"expectedSize":22711230,"receivedSize":22711230}} at amap2.html:930
复制代码



我这测试能输出
龙毅257 马路杀手 676Y币
代码怎么写的?大佬
龙毅257 马路杀手 676Y币
不是alert弹出吗?我的代码、
技术咨询-F 管理员 27137Y币
  1.   function fndownloadRegion() {
  2.         var aMap = api.require('aMap');
  3.         aMap.downloadRegion({
  4.             adcode: '110000',
  5.             shouldContinueWhenAppEntersBackground: true
  6.         }, function (ret) {
  7.             console.log(JSON.stringify(ret))
  8.         });
  9.     }
复制代码
龙毅257 · 2022-5-13 20:09代码怎么写的?大佬
龙毅257 马路杀手 676Y币
我的没有输出,还有其他设置吗?
12下一页
您需要登录后才可以回帖 登录

本版积分规则