【原创】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;  
    }  
}  
 

你可能感兴趣的:(android,.net,OS)