Code example for Intent

Methods: getActiongetBooleanExtragetStringExtra

0
        super("SubscribedFeedsIntentService"); 
    } 
 
    protected void onHandleIntent(Intent intent) {
        if (GTALK_DATA_MESSAGE_RECEIVED.equals(intent.getAction())) {
            boolean fromTrustedServer = intent.getBooleanExtra("from_trusted_server", false);
            if (fromTrustedServer) {
                String account = intent.getStringExtra("account");
                String token = intent.getStringExtra("message_token");
 
                if (TextUtils.isEmpty(account) || TextUtils.isEmpty(token)) {
                    if (Config.LOGD) {
                        Log.d(TAG, "Ignoring malformed tickle -- missing account or token.");
                    } 
                    return; 
                } 
 
                if (Config.LOGD) {
                    Log.d(TAG, "Received network tickle for "
                            + account + " - " + token);
                } 
 
                handleTickle(this, account, token);
            } else { 
                if (Log.isLoggable(TAG, Log.VERBOSE)) {
                    Log.v(TAG, "Ignoring tickle -- not from trusted server.");
                } 
            } 
 
        } else if (Intent.ACTION_BOOT_COMPLETED.equals(
                intent.getAction())) {
            if (Config.LOGD) {
                Log.d(TAG, "Received boot completed action");
            } 
            // load the time from the shared preferences and schedule an alarm 
            long refreshTime = getSharedPreferences(
                    sSubscribedFeedsPrefs,
                    Context.MODE_WORLD_READABLE).getLong(sRefreshTime, 0);
            scheduleRefresh(this, refreshTime);
        } else if (SUBSCRIBED_FEEDS_REFRESH_ACTION.equals(intent.getAction())) {
            if (Config.LOGD) {
                Log.d(TAG, "Received sSubscribedFeedsRefreshIntent");
            } 
            handleRefreshAlarm(this);
        } 
    }