FileDocCategorySizeDatePackage
ImServiceAutoStarter.javaAPI DocAndroid 1.5 API1948Wed May 06 22:42:46 BST 2009com.android.im.receiver

ImServiceAutoStarter

public class ImServiceAutoStarter extends android.content.BroadcastReceiver

Fields Summary
static final String
TAG
Constructors Summary
Methods Summary
public voidonReceive(android.content.Context context, android.content.Intent intent)


    
          
        // Received intent only when the system boot is completed
        Log.d(TAG, "onReceiveIntent");

        String selection = Im.Account.KEEP_SIGNED_IN + "=1 AND "
                + Im.Account.ACTIVE + "=1";
        Cursor cursor = context.getContentResolver().query(Im.Account.CONTENT_URI,
                new String[]{Im.Account._ID}, selection, null, null);
        if (cursor != null) {
            if (cursor.getCount() > 0) {
                Log.d(TAG, "start service");
                Intent serviceIntent = new Intent();
                serviceIntent.setComponent(ImServiceConstants.IM_SERVICE_COMPONENT);
                serviceIntent.putExtra(ImServiceConstants.EXTRA_CHECK_AUTO_LOGIN, true);
                context.startService(serviceIntent);
            }
            cursor.close();
        }