Broadcast Receiver
Register: ( On Create )
registerReceiver(NAMEReceiver,new IntentFilter("com.dplay.NAME"));
MORE BLOCK
}
private BroadcastReceiver NAMEReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
data = intent.getStringExtra("data");
}
};
{
SEND Broadcast
Intent intent=new Intent("com.dplay.NAME");
intent.putExtra("data", "your data here");
sendBroadcast(intent);
Start Service
Intent myService = new Intent(MainActivity.this, Background.class);
myService.putExtra("url", url);
startService(myService);
Andorid Manifest add service
<service
android:name="Background" >
</service>
Post a Comment