// 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();
}