bind/unbind service example (android)
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: can you give me a simple example of application with background service which uses bind/unbind methods to start and stop it? i was googling for it for an halfhour, but those examples uses startService/stopService methods or are very difficult for me. thank you. 回答1: You can try using this code: protected ServiceConnection mServerConn = new ServiceConnection () { @Override public void onServiceConnected ( ComponentName name , IBinder binder ) { Log . d ( LOG_TAG , "onServiceConnected" ); } @Override public void onServiceDisconnected