[android-developers] Re: [Applications signed by manufacturer/Permissions not granted] Correct approach to develop appliations for device manufacturers
Hi! Thank you for your response! Ok, I understand that it would be quite a difficult task and I should get familiar with Android source code in the first place. On 28 Lis, 14:39, Mark Murphy mmur...@commonsware.com wrote: On Mon, Nov 28, 2011 at 5:15 AM, cpphool cpph...@gmail.com wrote: I was wondering what is the correct approach when developing applications with non-public functionality for Android device manufacturers. Just say no. First of all, there are a lot of Android permissions that are not granted to 3rd party apps unless they are signed with manufacturer certificate, f.e. android.permission.READ_FRAME_BUFFER. http://developer.android.com/reference/android/Manifest.permission.ht... Android documentation says: Allows an application to take screen shots and more generally get access to the frame buffer data. Ok, so how can I take this screen shot? Is there some API? No. Or should I directly access framebuffer (like many applications that work on rooted devices do)? Your guess is as good as mine. 1) Where can I find out how these permissions exactly work? Read through the source code onhttp://source.android.com. Searching on the name of the permission frequently comes up with interesting stuff. 2) Should not there be some information if permissions are accessible by normal 3rd party applications or not? There isn't in the documentation. However, in frameworks/base/core/res/AndroidManifest.xml in the source code, you will see declarations like: !-- Allows an application to take screen shots and more generally get access to the frame buffer data -- permission android:name=android.permission.READ_FRAME_BUFFER android:label=@string/permlab_readFrameBuffer android:description=@string/permdesc_readFrameBuffer android:protectionLevel=signature / The android:protectionLevel tells you what is required. In this case, signature means that it must be signed with the same signing key as is used with the firmware. You will also sometimes see signatureOrSystem, which (from what I can tell) allows both signature-based apps and ones that reside in /system/app. 3) Secondly, is there a way of testing an applications that uses these non-public permissions? I assume that you would have rooted device in order to do so. But can you switch something in the rooted Android operating system so that it would grant all permissions for all applications? Not that I am aware of, but that's a far better question for some firmware-related Google Group, hosted over onhttp://source.android.com. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, One Low Price! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] [Applications signed by manufacturer/Permissions not granted] Correct approach to develop appliations for device manufacturers
Hi! I was wondering what is the correct approach when developing applications with non-public functionality for Android device manufacturers. First of all, there are a lot of Android permissions that are not granted to 3rd party apps unless they are signed with manufacturer certificate, f.e. android.permission.READ_FRAME_BUFFER. http://developer.android.com/reference/android/Manifest.permission.html#READ_FRAME_BUFFER Android documentation says: Allows an application to take screen shots and more generally get access to the frame buffer data. Ok, so how can I take this screen shot? Is there some API? Or should I directly access framebuffer (like many applications that work on rooted devices do)? So, to make long story short: 1) Where can I find out how these permissions exactly work? 2) Should not there be some information if permissions are accessible by normal 3rd party applications or not? 3) Secondly, is there a way of testing an applications that uses these non-public permissions? I assume that you would have rooted device in order to do so. But can you switch something in the rooted Android operating system so that it would grant all permissions for all applications? I understand that this might be some low level question, but I wasn't able to find any documentation concerning this subject. I would be grateful for any reponse! Kacper86 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Cannot always launch DevicePolicyManager activity from another activity
Hi, I have some strange problem. When I try to launch DevicePolicyManager activity from my main activity, it loads properly. However, when I make a notification, call QuestionActivity (if user clicks the notification), and then try to call DevicePolicyManager activity from QuestionActivity, I get (logcat): INFO/ActivityManager(104): Starting activity: Intent { act=android.app.action.ADD_DEVICE_ADMIN cmp=com.android.settings/.DeviceAdminAdd (has extras) } WARN/InputManagerService(104): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub $Proxy@4514a2d0 And nothing appears. This is strange for me, cause I'm able to launch different Android OS activity from QuestionActivity: //This works Intent intent = new Intent(Settings.ACTION_BLUETOOTH_SETTINGS); startActivity(intent); But I cannot launch the DevicePolicyManager with: //This works from main activity, but not from QuestionActivity MyDeviceAdmin admin = new MyDeviceAdmin(this); Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN); intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, admin.getDeviceAdminComponent()); intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, Additional text explaining why this needs to be added.); startActivityForResult(intent, 234234234); I would be very grateful for any help, cause I'm completely stuck. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: accessing and changing Sync setting for android 1.5, 1.6 and more
yes, i know it doesn't work on 1.6. there is a different content provider there or we do not have access to content://sync/settings. i have looked through android source code and in 1.6 file Sync.java disappears (it was available in 1.5). On 26 Kwi, 09:13, remy berrebi zehunte...@gmail.com wrote: i tryed your code, but it doesn't work on 1.6 :-( E/AndroidRuntime( 429): java.lang.IllegalArgumentException: Unknown URL content://sync/settings E/AndroidRuntime( 429): at android.content.ContentResolver.insert(ContentResolver.java:476) On Fri, Apr 23, 2010 at 11:38, cpphool cpph...@gmail.com wrote: I have added one modification and snippet works on htc magic (1.5) final Uri CONTENT_URI = Uri.parse(content://sync/settings); ContentValues values = new ContentValues(); values.put(name, sync_provider_contacts); values.put(value, true); // -- here - string true instead of boolean getContentResolver().insert(CONTENT_URI, values); On 21 Kwi, 15:12, remy berrebi zehunte...@gmail.com wrote: good news about android 2.x but actually, i want to make my application available for all major android version, like 1.6 and if possible 1.5 i'm still searching information. actually i'm trying to understand reflect mechanism, to see if i can call HIDE method and class and act on sync setting. but for now nothing work :-( On Tue, Apr 20, 2010 at 16:25, cpphool cpph...@gmail.com wrote: [android 2.x] as far as i know, Android 2.x introduces completely new sync mechanism (allowing use to use multi accounts). In order to check whether global auto-sync is on, you can use: ContentResolver.getMasterSyncAutomatically(); and to switch it on: ContentResolver.setMasterSyncAutomatically(true); [android 1.x] Did you find something about 1.6? and are you able to change auto-sync settings in 1.5? I tried with this snippet: final Uri CONTENT_URI = Uri.parse(content://sync/settings); ContentValues values = new ContentValues(); values.put(name, sync_provider_contacts); values.put(value, true); getContentResolver().insert(CONTENT_URI, values); The value changes to 1 instead of true and it doesn't affect sync settings. On 16 Kwi, 17:53, zehunter zehunte...@gmail.com wrote: hi, i'm not able to find any example or documentation or tutorial about how to enable or disable sync (background data and auto sync) programmaticaly, even if i can found many widget that can do that without root access or such. is it something secret? :-) can any one may be good enough to help me and explain how this work and how to implement that into my code? i found some trick with URI and content://sync/setting but it seems to be not possible with android 1.6 at least :-( any idea why? and what replaced this? thanks a thousand time for all people that will answer to me. best regards, -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com For more options, visit this group athttp:// groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group athttp:// groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message
[android-developers] Re: accessing and changing Sync setting for android 1.5, 1.6 and more
I have added one modification and snippet works on htc magic (1.5) final Uri CONTENT_URI = Uri.parse(content://sync/settings); ContentValues values = new ContentValues(); values.put(name, sync_provider_contacts); values.put(value, true); // -- here - string true instead of boolean getContentResolver().insert(CONTENT_URI, values); On 21 Kwi, 15:12, remy berrebi zehunte...@gmail.com wrote: good news about android 2.x but actually, i want to make my application available for all major android version, like 1.6 and if possible 1.5 i'm still searching information. actually i'm trying to understand reflect mechanism, to see if i can call HIDE method and class and act on sync setting. but for now nothing work :-( On Tue, Apr 20, 2010 at 16:25, cpphool cpph...@gmail.com wrote: [android 2.x] as far as i know, Android 2.x introduces completely new sync mechanism (allowing use to use multi accounts). In order to check whether global auto-sync is on, you can use: ContentResolver.getMasterSyncAutomatically(); and to switch it on: ContentResolver.setMasterSyncAutomatically(true); [android 1.x] Did you find something about 1.6? and are you able to change auto-sync settings in 1.5? I tried with this snippet: final Uri CONTENT_URI = Uri.parse(content://sync/settings); ContentValues values = new ContentValues(); values.put(name, sync_provider_contacts); values.put(value, true); getContentResolver().insert(CONTENT_URI, values); The value changes to 1 instead of true and it doesn't affect sync settings. On 16 Kwi, 17:53, zehunter zehunte...@gmail.com wrote: hi, i'm not able to find any example or documentation or tutorial about how to enable or disable sync (background data and auto sync) programmaticaly, even if i can found many widget that can do that without root access or such. is it something secret? :-) can any one may be good enough to help me and explain how this work and how to implement that into my code? i found some trick with URI and content://sync/setting but it seems to be not possible with android 1.6 at least :-( any idea why? and what replaced this? thanks a thousand time for all people that will answer to me. best regards, -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group athttp:// groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: accessing and changing Sync setting for android 1.5, 1.6 and more
[android 2.x] as far as i know, Android 2.x introduces completely new sync mechanism (allowing use to use multi accounts). In order to check whether global auto-sync is on, you can use: ContentResolver.getMasterSyncAutomatically(); and to switch it on: ContentResolver.setMasterSyncAutomatically(true); [android 1.x] Did you find something about 1.6? and are you able to change auto-sync settings in 1.5? I tried with this snippet: final Uri CONTENT_URI = Uri.parse(content://sync/settings); ContentValues values = new ContentValues(); values.put(name, sync_provider_contacts); values.put(value, true); getContentResolver().insert(CONTENT_URI, values); The value changes to 1 instead of true and it doesn't affect sync settings. On 16 Kwi, 17:53, zehunter zehunte...@gmail.com wrote: hi, i'm not able to find any example or documentation or tutorial about how to enable or disable sync (background data and auto sync) programmaticaly, even if i can found many widget that can do that without root access or such. is it something secret? :-) can any one may be good enough to help me and explain how this work and how to implement that into my code? i found some trick with URI and content://sync/setting but it seems to be not possible with android 1.6 at least :-( any idea why? and what replaced this? thanks a thousand time for all people that will answer to me. best regards, -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] T-Mobile Android Firmware - Pulse device - Data SMS Messages
Hi! I am developing an Android aplication that receives data messages (it is different than usual text messages and wap push). I have been testing it with different platforms and devices (Htc G1, Magic, Hero, Acer Liquid, Samsung Galaxy). It works on every device but T-Mobile Pulse. I am using this intent filter: intent-filter action android:name=android.intent.action.DATA_SMS_RECEIVED / data android:scheme=sms / data android:host=localhost / data android:port=3 / /intent-filter The problem is that on T-Mobile Pulse these messages apear in the inbox, but they are not catched by my app. I suppose it is connected with Pulse firmware. Is there any way I could ask for support from a team that had developed this firmware? I would be very grateful for any response! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
[android-developers] Re: Proper way of importing contacts to the device/contacts operations are very slow
thank you for your response! Unfortunately this method took even longer - 31sec on Magic. On 23 Mar, 15:50, timo prill timo.pr...@googlemail.com wrote: hey, try this. maybe its a faster approach to go directly through the ContentResolver instead of using createPersonInMyContactsGroup: ContentValues values = new ContentValues(); Uri uri; String id; ContentResolver cr = getContentResolver (); for (int i = 0; i 100; i++) { values.clear(); values.put(People.NAME, Test + i); uri = cr.insert(People.CONTENT_URI, values); id = uri.getLastPathSegment(); People.addToMyContactsGroup(cr, Long.parseLong(id)); } cheers. cpphool schrieb: Hi! Currently, I'm using HTC Magic (1.5) and Acer Liquid (1.6) to test the app. my sample code snippet for API 2.0: for (int i = 0; i 100; i++) { Log.d(TAG,iteracja + i); ContentValues personValues = new ContentValues(); personValues.put(Contacts.People.NAME, Test + i); personValues.put(Contacts.People.STARRED, 0); Uri newPersonUri = Contacts.People.createPersonInMyContactsGroup(getContentResolver(), personValues); } I did a few tests. Each time I changed NAME String in order to avoid duplicates. Results: 1) Acer Liquid (sync off) - 12 sec 2) Acer Liquid (sync on) - 30 sec 3) Acer Liquid (sync on) - 55 sec 4) Acer Liquid (sync on) - 35 sec 5) Acer Liquid (sync off) - 13 sec 1) HTC Magic (sync off) - 27 sec 2) HTC Magic (sync off) - stuck. log from logcat: ERROR/CursorWindow(13459): need to grow: mSize = 1048576, size = 279, freeSpace() = 162, numRows = 2789 ERROR/CursorWindow(13459): not growing since there are already 2789 row(s), max size 1048576 ERROR/CursorWindow(13459): The row failed, so back out the new row accounting from allocRowSlot 2788 ERROR/Cursor(13459): Failed allocating fieldDir at startPos 0 row 2788 DEBUG/Cursor(13459): finish_program_and_get_row_count row 2213 then I turned the sync off and my application started running again (without restarting the app)! took 30 sec to complete. Even if we turn off sync on HTC Magic it takes a long time to simply add empty contacts. Adding 5000 empty contacts (without any other operations) would take 1500sec = 25min. On 23 Mar, 11:55, timo prill timo.pr...@googlemail.com wrote: hi, which SDK version are you using? 1.5? 1.6? 2.0? 2.1? there were some changes to the contact api from 1.6 to 2.0... and maybe give a short snippet of how you insert the contacts to the database. maybe you do some (wrong) very time-consuming database-queries or you just missed something, because i have seen my code using the contact db implementation run way faster.. even with vcard-parsing full blown contacts...on the htc magic cheers cpphool schrieb: Hi! I have some questions concerning importing contacts to the device, which is extremely slow. First of all, if you delete all your contacts, google sync will restore it very quickly. However, when my app is adding contacts to the device, it's very slow (a few contacts per second). Even if I add almost empty contacts (with name only), it is a time-consuming process. If I turn google sync off, importing 5000 contacts can take 1-2 hours (on HTC Magic). When google sync is on it can take up to 24hours. And this happens despite the fact, that application for the whole time is in the foreground, device is connected to charger and screen is on. I checked the logcat to make sure my app is adding the contacts the whole time, and it is. I tried different methods and different devices. The results differ of course, yet manually adding contacts is always significantly slower that google sync. Is there any way that I can speed up the process? So that importing 5000 contacts will take less than an hour. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
[android-developers] Re: Proper way of importing contacts to the device/contacts operations are very slow
Can you give us some example? As I understand, AsynTask is used for threading. How should I use it to improve speed? I suppose I could create an AsyncTask with a method doInBackground(). This method would add only one contact at a time. Then, I call execute a hundred times. Is this what you mean? I will appreciate any more information :) On 29 Mar, 12:26, Nithin nithin.war...@gmail.com wrote: Use AsyncTask to update the contacts . Nithin On Mar 29, 2:56 pm, cpphool cpph...@gmail.com wrote: thank you for your response! Unfortunately this method took even longer - 31sec on Magic. On 23 Mar, 15:50, timo prill timo.pr...@googlemail.com wrote: hey, try this. maybe its a faster approach to go directly through the ContentResolver instead of using createPersonInMyContactsGroup: ContentValues values = new ContentValues(); Uri uri; String id; ContentResolver cr = getContentResolver (); for (int i = 0; i 100; i++) { values.clear(); values.put(People.NAME, Test + i); uri = cr.insert(People.CONTENT_URI, values); id = uri.getLastPathSegment(); People.addToMyContactsGroup(cr, Long.parseLong(id)); } cheers. cpphool schrieb: Hi! Currently, I'm using HTC Magic (1.5) and Acer Liquid (1.6) to test the app. my sample code snippet for API 2.0: for (int i = 0; i 100; i++) { Log.d(TAG,iteracja + i); ContentValues personValues = new ContentValues(); personValues.put(Contacts.People.NAME, Test + i); personValues.put(Contacts.People.STARRED, 0); Uri newPersonUri = Contacts.People.createPersonInMyContactsGroup(getContentResolver(), personValues); } I did a few tests. Each time I changed NAME String in order to avoid duplicates. Results: 1) Acer Liquid (sync off) - 12 sec 2) Acer Liquid (sync on) - 30 sec 3) Acer Liquid (sync on) - 55 sec 4) Acer Liquid (sync on) - 35 sec 5) Acer Liquid (sync off) - 13 sec 1) HTC Magic (sync off) - 27 sec 2) HTC Magic (sync off) - stuck. log from logcat: ERROR/CursorWindow(13459): need to grow: mSize = 1048576, size = 279, freeSpace() = 162, numRows = 2789 ERROR/CursorWindow(13459): not growing since there are already 2789 row(s), max size 1048576 ERROR/CursorWindow(13459): The row failed, so back out the new row accounting from allocRowSlot 2788 ERROR/Cursor(13459): Failed allocating fieldDir at startPos 0 row 2788 DEBUG/Cursor(13459): finish_program_and_get_row_count row 2213 then I turned the sync off and my application started running again (without restarting the app)! took 30 sec to complete. Even if we turn off sync on HTC Magic it takes a long time to simply add empty contacts. Adding 5000 empty contacts (without any other operations) would take 1500sec = 25min. On 23 Mar, 11:55, timo prill timo.pr...@googlemail.com wrote: hi, which SDK version are you using? 1.5? 1.6? 2.0? 2.1? there were some changes to the contact api from 1.6 to 2.0... and maybe give a short snippet of how you insert the contacts to the database. maybe you do some (wrong) very time-consuming database-queries or you just missed something, because i have seen my code using the contact db implementation run way faster.. even with vcard-parsing full blown contacts...on the htc magic cheers cpphool schrieb: Hi! I have some questions concerning importing contacts to the device, which is extremely slow. First of all, if you delete all your contacts, google sync will restore it very quickly. However, when my app is adding contacts to the device, it's very slow (a few contacts per second). Even if I add almost empty contacts (with name only), it is a time-consuming process. If I turn google sync off, importing 5000 contacts can take 1-2 hours (on HTC Magic). When google sync is on it can take up to 24hours. And this happens despite the fact, that application for the whole time is in the foreground, device is connected to charger and screen is on. I checked the logcat to make sure my app is adding the contacts the whole time, and it is. I tried different methods and different devices. The results differ of course, yet manually adding contacts is always significantly slower that google sync. Is there any way that I can speed up the process? So that importing 5000 contacts will take less than an hour. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from
[android-developers] Proper way of importing contacts to the device/contacts operations are very slow
Hi! I have some questions concerning importing contacts to the device, which is extremely slow. First of all, if you delete all your contacts, google sync will restore it very quickly. However, when my app is adding contacts to the device, it's very slow (a few contacts per second). Even if I add almost empty contacts (with name only), it is a time-consuming process. If I turn google sync off, importing 5000 contacts can take 1-2 hours (on HTC Magic). When google sync is on it can take up to 24hours. And this happens despite the fact, that application for the whole time is in the foreground, device is connected to charger and screen is on. I checked the logcat to make sure my app is adding the contacts the whole time, and it is. I tried different methods and different devices. The results differ of course, yet manually adding contacts is always significantly slower that google sync. Is there any way that I can speed up the process? So that importing 5000 contacts will take less than an hour. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
[android-developers] Re: Proper way of importing contacts to the device/contacts operations are very slow
Hi! Currently, I'm using HTC Magic (1.5) and Acer Liquid (1.6) to test the app. my sample code snippet for API 2.0: for (int i = 0; i 100; i++) { Log.d(TAG,iteracja + i); ContentValues personValues = new ContentValues(); personValues.put(Contacts.People.NAME, Test + i); personValues.put(Contacts.People.STARRED, 0); Uri newPersonUri = Contacts.People.createPersonInMyContactsGroup(getContentResolver(), personValues); } I did a few tests. Each time I changed NAME String in order to avoid duplicates. Results: 1) Acer Liquid (sync off) - 12 sec 2) Acer Liquid (sync on) - 30 sec 3) Acer Liquid (sync on) - 55 sec 4) Acer Liquid (sync on) - 35 sec 5) Acer Liquid (sync off) - 13 sec 1) HTC Magic (sync off) - 27 sec 2) HTC Magic (sync off) - stuck. log from logcat: ERROR/CursorWindow(13459): need to grow: mSize = 1048576, size = 279, freeSpace() = 162, numRows = 2789 ERROR/CursorWindow(13459): not growing since there are already 2789 row(s), max size 1048576 ERROR/CursorWindow(13459): The row failed, so back out the new row accounting from allocRowSlot 2788 ERROR/Cursor(13459): Failed allocating fieldDir at startPos 0 row 2788 DEBUG/Cursor(13459): finish_program_and_get_row_count row 2213 then I turned the sync off and my application started running again (without restarting the app)! took 30 sec to complete. Even if we turn off sync on HTC Magic it takes a long time to simply add empty contacts. Adding 5000 empty contacts (without any other operations) would take 1500sec = 25min. On 23 Mar, 11:55, timo prill timo.pr...@googlemail.com wrote: hi, which SDK version are you using? 1.5? 1.6? 2.0? 2.1? there were some changes to the contact api from 1.6 to 2.0... and maybe give a short snippet of how you insert the contacts to the database. maybe you do some (wrong) very time-consuming database-queries or you just missed something, because i have seen my code using the contact db implementation run way faster.. even with vcard-parsing full blown contacts...on the htc magic cheers cpphool schrieb: Hi! I have some questions concerning importing contacts to the device, which is extremely slow. First of all, if you delete all your contacts, google sync will restore it very quickly. However, when my app is adding contacts to the device, it's very slow (a few contacts per second). Even if I add almost empty contacts (with name only), it is a time-consuming process. If I turn google sync off, importing 5000 contacts can take 1-2 hours (on HTC Magic). When google sync is on it can take up to 24hours. And this happens despite the fact, that application for the whole time is in the foreground, device is connected to charger and screen is on. I checked the logcat to make sure my app is adding the contacts the whole time, and it is. I tried different methods and different devices. The results differ of course, yet manually adding contacts is always significantly slower that google sync. Is there any way that I can speed up the process? So that importing 5000 contacts will take less than an hour. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.