Android Question Performance

Vincenzo

Member
Licensed User
Longtime User
performance
I have two performance problems:

1)
it is normal that a service remains stopped for two seconds ago block all program?

The service is configured as follows:

# Region Module Attributes
# StartAtBoot: true
# StartCommandReturnValue: android.app.Service.START_STICKY
# End Region


2) I need to read (in Service) all the phone numbers in the address book, however, for each phone number takes too long time!

This instruction allows me to read quickly:

ContactsList= PhoneContacts.GetAll (False, False)

still continuing,
...
Dim c As Contact
c = ContactsList.get (i)
For j = 0 To c.GetPhones.Size-1
c.GetPhones.GetKeyAt (j) 'This statement it takes you 8ms up to 45 ms to read a single phone number!
 

Vincenzo

Member
Licensed User
Longtime User
Hi Erel,
sorry the call
cu.GetPhones(c.Id) is equals at c.GetPhones.GetKeyAt (j).
but it is possible that it takes so much time to read a phone number?
10ms for each number to read? In addition, because if I can manage in a service stops me the whole system? Android is not multi tasking? I use Android 4.3.
 
Upvote 0

Vincenzo

Member
Licensed User
Longtime User
I entered the thread library, and inserted in the method of the thread contact management, but I always freeze the application. How is it possible that even with the library thread will block the whole program? My problem is not reading the contacts but the reading of individual telephone numbers. Extract a phone number from the map takes me an average of 10ms.
 
Upvote 0

Vincenzo

Member
Licensed User
Longtime User
you've tried to extract the data with ContactsUtils but it takes the same time.
Can I try GetContactsAsync, but the problem is not in the call to the reading of the contacts, the problem I have it later, for each phone number that I read it takes me about 10 ms. To extract phone numbers 100 takes me about 1 second.
Now I've also GetContactsAsync and let you know.
 
Upvote 0

Vincenzo

Member
Licensed User
Longtime User
Hi Erel,

not use getphone, each contact may have more than one number. and I take them in this way:
Dim c As Contact
dim s as String
c = ContactsList.get (i)
For j = 0 To c.GetPhones.Size-1
s=c.GetPhones.GetKeyAt (j) 'This statement it takes you 8ms up to 45 ms to read a single phone number!
 
Upvote 0

Vincenzo

Member
Licensed User
Longtime User
Okay, if the weather is this good.
I can not run "GetContactsAsync" is an example?
with threads would be easier but the class is threding is false threading?
or must be set properly? I created the thread that locks the whole system!
at this point with the thread should solve ...
 
Upvote 0

Vincenzo

Member
Licensed User
Longtime User
Yes, I want to retrieve all phone numbers.
Since it is not possible to know if a new number is entered, every day I check periodically if there are differences in phone numbers. The operation is done once a day and should not be done quickly, but it should be very slow and it should not even bother to the main process.
I'd be happy if the class threading worked!
But I have tested and I saw that if I start a process that lasts a long time, the system goes to interfere with the main program. I'm wrong to use the class threading? or class threading is simulated and not real?
 
Upvote 0
Top