Skip to content

Instantly share code, notes, and snippets.

@Amimul100
Last active September 8, 2015 09:32
Show Gist options
  • Save Amimul100/418b5df5d8f2d0377786 to your computer and use it in GitHub Desktop.
Save Amimul100/418b5df5d8f2d0377786 to your computer and use it in GitHub Desktop.
/*Hello, I have tested this with latesat SDK 4.1.0.GA in Android platform 5.1.0, Device Nexus 7.
HTTPClient ondatastream is working as expected.
*/
var url = "http://www.7-zip.org/a/7za920.zip";
var xhr = Ti.Network.createHTTPClient({
onload : function(e) {
Ti.API.info('success');
Ti.API.info('done');
},
ondatastream : function(e) {
Ti.API.info(e.progress);
},
onerror : function(e) {
Ti.API.info('error');
},
timeout : 5000
});
xhr.open("GET", url);
xhr.send();
[INFO] : 0.0030947443912629985
[INFO] : 0.0068572883698934115
[INFO] : 0.010619832348523825
[INFO] : 0.014382376327154238
[INFO] : 0.018144920305784653
[INFO] : 0.021907464284415066
[INFO] : 0.02567000826304548
[INFO] : 0.029432552241675892
[INFO] : 0.0331950962203063
[INFO] : 0.036957640198936714
[INFO] : 0.04760085852522827
[INFO] : 0.058244076851519826
[INFO] : 0.06888729517781138
[INFO] : 0.07953051350410294
[INFO] : 0.0901737318303945
[INFO] : 0.10081695015668606
[INFO] : 0.1114601684829776
[INFO] : 0.11220851977154499
[INFO] : 0.1159710637501754
[INFO] : 0.11973360772880581
[INFO] : 0.12349615170743622
[INFO] : 0.12725869568606663
[INFO] : 0.13102123966469706
[INFO] : 0.13478378364332746
[INFO] : 0.13854632762195787
[INFO] : 0.14230887160058828
[INFO] : 0.1460714155792187
[INFO] : 0.14983395955784912
[INFO] : 0.15359650353647952
[INFO] : 0.15735904751510993
[INFO] : 0.16112159149374036
[INFO] : 0.16488413547237077
[INFO] : 0.16864667945100117
[INFO] : 0.17240922342963158
[INFO] : 0.17617176740826201
[INFO] : 0.17993431138689242
[INFO] : 0.18369685536552283
[INFO] : 0.18745939934415323
[INFO] : 0.19122194332278367
[INFO] : 0.19498448730141407
[INFO] : 0.19874703128004448
[INFO] : 0.2025095752586749
[INFO] : 0.20627211923730532
[INFO] : 0.21003466321593572
[INFO] : 0.21379720719456613
[INFO] : 0.21755975117319656
[INFO] : 0.22508483913045738
[INFO] : 0.22884738310908778
[INFO] : 0.23260992708771822
[INFO] : 0.23637247106634862
[INFO] : 0.24013501504497903
[INFO] : 0.24389755902360943
[INFO] : 0.24766010300223987
[INFO] : 0.25142264698087025
[INFO] : 0.2551851909595007
[INFO] : 0.2589477349381311
[INFO] : 0.2664728228953919
[INFO] : 0.27023536687402233
[INFO] : 0.27399791085265274
[INFO] : 0.27776045483128314
[INFO] : 0.28152299880991355
[INFO] : 0.285285542788544
[INFO] : 0.2890480867671744
[INFO] : 0.29657317472443523
[INFO] : 0.30409826268169604
[INFO] : 0.30786080666032645
[INFO] : 0.3116233506389569
[INFO] : 0.3222665689652484
[INFO] : 0.33290978729153997
[INFO] : 0.34355300561783153
[INFO] : 0.3454862464466306
[INFO] : 0.349248790425261
[INFO] : 0.35301133440389143
[INFO] : 0.35677387838252184
[INFO] : 0.36053642236115224
[INFO] : 0.36429896633978265
[INFO] : 0.36806151031841305
[INFO] : 0.3718240542970435
[INFO] : 0.3755865982756739
[INFO] : 0.37934914225430433
[INFO] : 0.38311168623293473
[INFO] : 0.38687423021156514
[INFO] : 0.39063677419019555
[INFO] : 0.39439931816882595
[INFO] : 0.39816186214745636
[INFO] : 0.4019244061260868
[INFO] : 0.4056869501047172
[INFO] : 0.40944949408334763
[INFO] : 0.41321203806197804
[INFO] : 0.41697458204060844
[INFO] : 0.42073712601923885
[INFO] : 0.42449966999786926
[INFO] : 0.4282622139764997
[INFO] : 0.43578730193376053
[INFO] : 0.43954984591239094
[INFO] : 0.44707493386965175
[INFO] : 0.45083747784828215
[INFO] : 0.45460002182691256
[INFO] : 0.458362565805543
[INFO] : 0.4621251097841734
[INFO] : 0.46588765376280383
[INFO] : 0.47341274172006464
[INFO] : 0.48093782967732546
[INFO] : 0.48470037365595586
[INFO] : 0.4884629176345863
[INFO] : 0.49222546161321673
[INFO] : 0.49598800559184714
[INFO] : 0.49975054957047754
[INFO] : 0.503513093549108
[INFO] : 0.5072756375277384
[INFO] : 0.5110381815063688
[INFO] : 0.5148007254849992
[INFO] : 0.5185632694636296
[INFO] : 0.52232581344226
[INFO] : 0.5260883574208904
[INFO] : 0.5298509013995208
[INFO] : 0.5336134453781513
[INFO] : 0.5373759893567817
[INFO] : 0.5411385333354121
[INFO] : 0.5449010773140425
[INFO] : 0.5486636212926729
[INFO] : 0.5524261652713033
[INFO] : 0.5599512532285642
[INFO] : 0.567476341185825
[INFO] : 0.5712388851644554
[INFO] : 0.5750014291430858
[INFO] : 0.5787639731217162
[INFO] : 0.5825265171003466
[INFO] : 0.586289061078977
[INFO] : 0.5938141490362379
[INFO] : 0.5975766930148683
[INFO] : 0.6013392369934987
[INFO] : 0.6051017809721291
[INFO] : 0.6088643249507595
[INFO] : 0.6126268689293899
[INFO] : 0.6163894129080203
[INFO] : 0.6201519568866508
[INFO] : 0.6239145008652812
[INFO] : 0.6276770448439116
[INFO] : 0.631439588822542
[INFO] : 0.6352021328011724
[INFO] : 0.6389646767798028
[INFO] : 0.6427272207584332
[INFO] : 0.6464897647370637
[INFO] : 0.6502523087156941
[INFO] : 0.6540148526943245
[INFO] : 0.6615399406515853
[INFO] : 0.6653024846302157
[INFO] : 0.6690650286088461
[INFO] : 0.6728275725874765
[INFO] : 0.676590116566107
[INFO] : 0.6803526605447374
[INFO] : 0.6841152045233678
[INFO] : 0.6916402924806286
[INFO] : 0.695402836459259
[INFO] : 0.6991653804378894
[INFO] : 0.7029279244165199
[INFO] : 0.7066904683951503
[INFO] : 0.7104530123737807
[INFO] : 0.7142155563524111
[INFO] : 0.7179781003310415
[INFO] : 0.7217406443096719
[INFO] : 0.7255031882883023
[INFO] : 0.7292657322669327
[INFO] : 0.7330282762455632
[INFO] : 0.7367908202241936
[INFO] : 0.740553364202824
[INFO] : 0.7443159081814544
[INFO] : 0.7480784521600848
[INFO] : 0.7518409961387152
[INFO] : 0.7556035401173457
[INFO] : 0.7593660840959761
[INFO] : 0.7631286280746065
[INFO] : 0.7668911720532369
[INFO] : 0.7706537160318673
[INFO] : 0.7744162600104977
[INFO] : 0.7781788039891281
[INFO] : 0.7819413479677585
[INFO] : 0.7857038919463889
[INFO] : 0.7894664359250193
[INFO] : 0.7932289799036498
[INFO] : 0.7969915238822802
[INFO] : 0.8007540678609106
[INFO] : 0.804516611839541
[INFO] : 0.8082791558181714
[INFO] : 0.8120416997968019
[INFO] : 0.8158042437754323
[INFO] : 0.8195667877540627
[INFO] : 0.8233293317326931
[INFO] : 0.8270918757113235
[INFO] : 0.8308544196899539
[INFO] : 0.8346169636685843
[INFO] : 0.8383795076472147
[INFO] : 0.8421420516258451
[INFO] : 0.8459045956044755
[INFO] : 0.849667139583106
[INFO] : 0.8534296835617364
[INFO] : 0.8571922275403668
[INFO] : 0.8609547715189972
[INFO] : 0.8647173154976276
[INFO] : 0.868479859476258
[INFO] : 0.8722424034548885
[INFO] : 0.8760049474335189
[INFO] : 0.8797674914121493
[INFO] : 0.8835300353907797
[INFO] : 0.8872925793694101
[INFO] : 0.8910551233480405
[INFO] : 0.8948176673266709
[INFO] : 0.8985802113053013
[INFO] : 0.9023427552839317
[INFO] : 0.9061052992625621
[INFO] : 0.9098678432411926
[INFO] : 0.913630387219823
[INFO] : 0.9173929311984534
[INFO] : 0.9211554751770838
[INFO] : 0.9286805631343447
[INFO] : 0.9324431071129751
[INFO] : 0.9362056510916055
[INFO] : 0.9399681950702359
[INFO] : 0.9437307390488663
[INFO] : 0.9474932830274967
[INFO] : 0.9512558270061271
[INFO] : 0.9550183709847575
[INFO] : 0.9587809149633879
[INFO] : 0.9625434589420183
[INFO] : 0.9663060029206488
[INFO] : 0.9700685468992792
[INFO] : 0.9738310908779096
[INFO] : 0.97759363485654
[INFO] : 0.9813561788351705
[INFO] : 0.9851187228138009
[INFO] : 0.9888812667924313
[INFO] : 0.9926438107710617
[INFO] : 0.9964063547496921
[INFO] : 1
[INFO] : success
[INFO] : done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment