Android - Application Components - بخش Broadcast Receivers

Broadcast Receivers simply respond to broadcast messages from other applications or from the system. For example, applications can also initiate broadcasts to let other applications know that some data has been downloaded to the device and is available for them to use, so this is broadcast receiver who will intercept this communication and will initiate appropriate action.

A broadcast receiver is implemented as a subclass of BroadcastReceiverclass and each message is broadcaster as an Intent object.

publicclassMyReceiverextendsBroadcastReceiver{
publicvoid onReceive(context,intent){

}
}




Android - Application Components - بخش Services

A service is a component that runs in the background to perform long-running operations. For example, a service might play music in the background while the user is in a different application, or it might fetch data over the network without blocking user interaction with an activity.

publicclassMyServiceextendsService{

}

Services یک کامپوننت است که در پشت صحنه اجرا می گردد و وظیفه اجرا و مدیریت برنامه های پشت صحنه
را بر عهدا دارد و برای بوجود اوردن برنامه هایی مانند پخش موسیقی و یا ارسال داده به اینترنت استفاده می گردد.


Android - Application Components - بخش Activities

An activity represents a single screen with a user interface,in-short Activity performs actions on the screen. For example, an email application might have one activity that shows a list of new emails, another activity to compose an email, and another activity for reading emails. If an application has more than one activity, then one of them should be marked as the activity that is presented when the application is launched.

An activity is implemented as a subclass of Activity class as follows

public class MainActivity extends Activity {

}

 


 

اکتیویتی یک فایل جاوا می باشد که به صورت single page می باشد و به یک View مختص می باشد و اطلاعات خود را از View مرتبطش دریافت و ارسال می دارد.