Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Why OpenToRead command is much faster in broadcast mode than in apk compiled mode ???

Author
Message
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 26th Feb 2013 03:29 Edited at: 26th Feb 2013 03:43
(in Tier1 v1088)

After APK compilation the program take 5/7 seconds to Open a 500KB file (just the "OpenToRead" command ... not the loop to read content lines !)

In broadcasting mode (on the same devices) .. it's very quick ... less than 0.5 second. What is the difference ? i use the same Android source to compile the player and standalone package ...

(Tested on several Android devices ... )
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 26th Feb 2013 05:01
Does it always take long to open the file every time you run the app? Maybe slow on the first time?

Are you by any chance running the apk through Eclipse?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 26th Feb 2013 12:49 Edited at: 26th Feb 2013 12:50
Quote: "Does it always take long to open the file every time you run the app?"


Yes, Everytime.


Quote: "Maybe slow on the first time?"


Not Only

Quote: "Are you by any chance running the apk through Eclipse?"


When i run it from eclipse, it's the same thing .. it takes a long time. When i compile the package and deploy it manually, same issue.

In windows and when broadcasted through the android player : no problem.

You can try to simply call the "OpenToRead" command on a 500KB or 1MB text file and you will see (and if not .. i will check for my eclipse environment...)
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 26th Feb 2013 13:57
Only Paul or Lee can answer this - but I suspect that the problem is that the file is being extracted from the APK (zip) file - whereas when broadcast to the player it is sent unzipped.

I would try copying it to the user folder - that will be slow the first time, but then you could read it from there instead of the /media folder.

But I may be talking rubbish - has been known!

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Juande
12
Years of Service
User Offline
Joined: 2nd Sep 2011
Location:
Posted: 26th Feb 2013 14:11
Hi,

I have done a lot of test with opentoread, opentowrite, extractfile... using files of reading folder and the files are opened very fast in both (agk-player and apk). Even, I think that APK is faster. There is not problem. (7 Mb, ~3-4 seconds).

Can you show your code?
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 26th Feb 2013 14:34 Edited at: 26th Feb 2013 14:40
an APK file is an installer package no ?

Media files (and my TXT file which causes my problem) are already unzipped when i launch the app (i guess ... ...

My code is exactly like that :

Juande
12
Years of Service
User Offline
Joined: 2nd Sep 2011
Location:
Posted: 26th Feb 2013 15:28
It's strange... opening a file is very fast (3 milliseconds in samsung galaxy mini for a file of 640Kb)... I didn't read "just the opentoread command" and thought you had problems with the reading (slower)...

I have tested your code and built the file "open.apk"
The code is yours. The file size is 640 kb.

In my phone 3 millisecods (AGK and APK)...

Can you try it in your phone?

Attachments

Login to view attachments
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 26th Feb 2013 15:31
already tested on samsung S3, on nexus 10 .... samething ..

I will try to rebuild my entire APK from my AppGameKit Player sources (which works well when used as broadcast receiver) ...
Juande
12
Years of Service
User Offline
Joined: 2nd Sep 2011
Location:
Posted: 26th Feb 2013 15:58
Ok! But it's strange...in AppGameKit player, you get ~0.5 seconds (i suppose 400-500 ms) and I think this value is very high... furthermore samsung s3 or nexus 10 is high-end (i guess...). You should get 1 millisecond (I get 3, and my phone is middle-range or low-end)

I don't know... Have you tried with other txt files?
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 26th Feb 2013 16:19
less than 0.5 seconds in fact when broadcasting. maybe few milliseconds yes but in standalone ... 10 seconds or more for 500KB/1MB file.

I will try several things.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 26th Feb 2013 18:18
MikeMax, I think this is the same issue as I responded to in the Android thread. The first time the app is run, rewrite the file and it will go to the sandbox area and will probably open much faster.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master

Login to post a reply

Server time is: 2024-05-02 11:23:03
Your offset time is: 2024-05-02 11:23:03