Android - how to run a socket in a long lives background thread

前端 未结 2 470
闹比i
闹比i 2020-12-28 09:41

I\'m building a simple chat that connects between an android client and a java server (running on my pc). The user can send and receive messages to/from the android app and

2条回答
  •  鱼传尺愫
    2020-12-28 10:46

    I suggest you take a look at the Android documentation for background services. Personally I would use the IntentService as it's a well established pattern within Android.

    http://developer.android.com/training/run-background-service/index.html

提交回复
热议问题