首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

Service 示例

2012-08-30 
【原创】Service 示例package com.firewings.smstoolsimport android.app.Serviceimport android.content.

【原创】Service 示例

package com.firewings.smstools;    import android.app.Service;  import android.content.Intent;  import android.net.Uri;  import android.os.Handler;  import android.os.IBinder;  import android.util.Log;    public class SmsListener extends Service {        private static String TAG = "SmsListener";        @Override      public void onCreate() {          // TODO Auto-generated method stub          super.onCreate();          Log.i(TAG, "SmsListener is running");          getContentResolver().registerContentObserver(Uri.parse("content://sms"), true, new SmsObserver(this, new Handler()));      }        @Override      public IBinder onBind(Intent intent) {          // TODO Auto-generated method stub          return null;      }  }  
?

热点排行