Yii Framework and Android Application

Check out this: Yii REST API


You can use JSON / XML to communicate your android application with the php yii framework by building a simple REST API.

In order to do use the REST API this, you need to send HTTP request (Get / Post) from Android application. Then perform your operation based upon the request and send again in JSON formate using php json_encode or XML if you preferred.

You can also perform it using google Gson. it will help you to create JSON from java object.


Refer this: Simple API using Yii

I have done similar recently,

Yii side

you need custom controller sending json array and you can refer Yii REST API

public function actionTest()
{

    $commands = Command::model()->findAll();
    $cmdlist = array();

    if( $commands != '0'){
        foreach( $commands as $item ) 
        {
            $object = array();
            $object ['cmd'] = $item->command;
            $object ['command'] = $item->getCommandOptions($item->command);
            $object ['number'] = $item->number;
            $object ['id'] = $item->id;
            $cmdlist[] = $object;
        }
        $arr['command'] = $cmdlist;
    }

    header('Content-type: application/json');
    echo json_encode($arr);
    Yii::app()->end();
}

android side

You need a neat Async Http client with Json parser. I used android-async-http