Please enable Javascript to view the contents

android后台不死

 ·  ☕ 1 分钟

public class MainActivity extends Activity {
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        System.out.println("MainActivity  OnCreate()....");
        
        System.out.println("准备开启服务");
        Intent intent = new Intent(MainActivity.this,TestService.class);  
        startService(intent);  
    }
}