has anyone know how to restarting a service in android?? i have a service that called when device is booting.. and i have an option.java for saving my configuration..
if i editing a configuration in option.java, then i must restarting my service to takes the effect..
i only know how to start a service and after it running, i don't know how to restart it after a new configuration was made.. any idea??
startService(new Intent(this, ListenSMSservice.class));
解决方案
In your element:
2) In your element (be sure to use a fully-qualified [or relative] class name for your BroadcastReceiver):
public class MyBroadcastreceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Intent startServiceIntent = new Intent(context, MyService.class);
context.startService(startServiceIntent);
}
}
for more elaboration : this