During Android development, every time startservice (intent) is called, The onstartcommand (intent, Int, INT) method of the service object will be called, and some processing will be done in the onstartcommand method. Then we noticed that this function has an int return value. Article It is to briefly explain the function of int return values. From the official Android documentation, we know that onstartcommand has four return values: Start _ Sticky: if the service process is killed, the Service State will be retained to the starting state, but the intent object for delivery will not be retained. Then the system will try to re-create the service. Because the service status is starting, the onstartcommand (intent, Int, INT) method will be called after the service is created. If no startup command is passed to service during this period, the intent parameter is null. Start _ Not_sticky: "non-viscous ". When this return value is used, if the service is kill abnormally after onstartcommand is executed, the system will not automatically restart the service. Start _ Redeliver_intent: Re-transmits intent. When this return value is used, if the service is kill abnormally after onstartcommand is executed, the system automatically restarts the service and passes in the intent value. Start _ Sticky_compatibility: Start _ Sticky compatible version, but it is not guaranteed that the service will be restarted after it is killed.