ActivityManager.restartPackage() and syncing - Sync on StatusBar remains after killing

by Dianne Hackborn » Sat, 03 Oct 2009 00:47:14 GMT


Sponsored Links
 You'll probably need to reboot your device.  You could try toggling the sync
checkbox to make it restart a sync, but this may not complete fix things.
 Force stopping built-in applications is playing with fire. :)  (Fwiw,
possibly you force stopped the apk in gapps that managers the connection to
the google services, so you no longer are getting tickles to cause updates
and other things related to your account.)






-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Suara spica kok agak kresek2?

Guys sejak awal beli spica gw suaranya ada suara kresek2 kecil.. Memang dr awal 
ga pake headset asli, pakenya punya phillips. Dicoba pake speaker sonic gear 
juga, walaupun berkurang.. 

Spica udah pake samdroid dengan eclair... 

Ada yg punya penyakit serupa?


Regard

Alex
sent from Android
full speed ahead!!!

-- 
"Indonesian Android Community [id-android]" 

2. About the Account and the ContactsContract API

Hi,

I'm creating my first Android application and I'm looking for a few
advices on several subjects. The context is simple: my application
connects itself to several Instant Messaging servers and it creates a
RawContact in the Contact Provider each one for the contacts found on
these servers. At this time, I got everything working, but I'm not
fully satisfied on several points:




First point: AccountManager

I successfully managed to create an simple account authenticator that
create a new account dedicated to my application. There is no real
authentication behind it, it simply create an empty Account if needed,
that's all. Everything works in an emulator v2.2, however, I can't
even bind to my "AuthenticatorService" in an emulator v2.1-update1.

Here is the error I retrieve from the logcat:

DEBUG/AccountManagerService(64): bind attempt failed for Session:
expectLaunch false, connected false, stats (0/0/0), lifetime 0.001,
addAccount, accountType ACCOUNT_UNIFIED_IM_TYPE, requiredFeatures null

Here is the part of the AndroidManifest.xml related to that
Authenticator:

        <service
android:name=".service.core.authenticator.AuthenticatorService"
                android:exported="true">
                <intent-filter>
                        <action 
android:name="android.accounts.AccountAuthenticator" />
                </intent-filter>
                <meta-data android:name="android.accounts.AccountAuthenticator"
                        android:resource="@xml/authenticator" />
        </service>

And here is the content of the file named '/res/xml/
authenticator.xml':

        <?xml version="1.0" encoding="utf-8"?>
        <account-authenticator xmlns:android="http://schemas.android.com/apk/
res/android"
                android:accountType="@string/account_type"
                android:icon="@drawable/unified_im_icon"
                android:smallIcon="@drawable/unified_im_icon"
                android:label="@string/app_name"
        />




Second point: creating a RawContact

Once my Account is created (or retrieved), I try to add a new
RawContact, but it seems to me that this process is reeeeaaaally slow,
so I'm wondering if I do it the right way and if you have any tips
that would allow my to speed it up. Here is my code:

        ContentValues lValues = new ContentValues();
        lValues.put(RawContacts.ACCOUNT_TYPE, lAccountType);
        lValues.put(RawContacts.ACCOUNT_NAME, lAccountName);
        Uri lRawContactUri =
mService.getContentResolver().insert(RawContacts.CONTENT_URI,
lValues);

        Uri lDataUri = Uri.withAppendedPath(lRawContactUri,
Data.CONTENT_DIRECTORY);

        ContentValues[] lData = new ContentValues[2];
        lData[0] = new ContentValues();
        lData[0].put(Entity.RAW_CONTACT_ID, lContact.getSystemId());
        lData[0].put(Entity.MIMETYPE, Im.CONTENT_ITEM_TYPE);
        lData[0].put(Im.PROTOCOL, ProtocolUtils.toSystemProtocol(pProtocol));
        lData[0].put(Im.DATA, pHandle);

        lData[1] = new ContentValues();
        lData[1].put(Entity.RAW_CONTACT_ID, lContact.getSystemId());
        lData[1].put(Entity.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE);
        lData[1].put(StructuredName.DISPLAY_NAME, pDisplayName);

        mService.getContentResolver().bulkInsert(lDataUri, lData);

(Yeah, I know, and I'm really sorry for the lack of documentation...)




Third point: reading a list of RawContacts

That's the point that  I'm not really proud of, not that the process
is slow, but I'm sure there is a away to make it simpler. Here is what
I do:

1 - First, I query the ContactManager in order to retrieve the _ID of
all the RawContacts that matches my Account:
        Cursor lCursor = lResolver.query(
                RawContacts.CONTENT_URI,
                new String[] {RawContacts._ID},
                RawContacts.ACCOUNT_NAME + "=? AND " + RawContacts.ACCOUNT_TYPE 
+
"=?",
                new String[] {lAccountName, lAccountType},
                null);

2 - Then, for EACH RawContact I query the ContentManager in order to
retrieve its IM data, and an other query in order to retrieve its
Display Name:

        Cursor lRawCursor = lResolver.query(
                lRawContactUri,
                new String[] {Im.PROTOCOL, Im.DATA},
                Data.MIMETYPE + "=?",
                new String[] {Im.CONTENT_ITEM_TYPE},
                null);

        lRawCursor = lResolver.query(
                lRawContactUri,
                new String[] {StructuredName.DISPLAY_NAME},
                Data.MIMETYPE + "=?",
                new String[]{StructuredName.CONTENT_ITEM_TYPE},
                null);




So here are my main problems, I'm pretty sure that there are some tips
that would allow me to do the same thing more efficiently, I just hope
someone will be here to give me them ;)

-- 

3. Suggestion for Google Navigation

4. Scrollable widgets in alternative Home applications.

5. broken pipe exception

6. One of my application is invisible now on the market (Pure messenger / not copy protected)

7. how can we set the background of button with bitmap image........which is cre