1/* 2 * 3 * Copyright 2001-2011 Texas Instruments, Inc. - http://www.ti.com/ 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18package com.ti.server; 19 20import android.app.Service; 21import android.content.Intent; 22import android.os.IBinder; 23import android.os.RemoteException; 24import android.util.Log; 25import com.ti.fm.IFmRadio; 26import com.ti.server.StubFmService; 27import android.content.Context; 28 29public final class FmService extends Service { 30 31 /** TAG for log. */ 32 private static final String TAG = "FmService"; 33 34 /** 35 * IBinder of this service. 36 */ 37 private final IFmRadio.Stub mBinder = new StubFmService(); 38 39 /** 40 * Called by the system when the service is first created. Do not call this 41 * method directly. 42 */ 43 @Override 44 public void onCreate() { 45 Log.i(TAG, "onCreate called"); 46 super.onCreate(); 47 ((StubFmService) mBinder).init(this); 48 } 49 50 /** 51 * Called by the system to notify a Service that it is no longer used and is 52 * being removed. The service should clean up an resources it holds (threads 53 * registered receivers, etc) at this point. Upon return, there will be no 54 * more calls in to this Service object and it is effectively dead. 55 */ 56 @Override 57 public void onDestroy() { 58 Log.i(TAG, "onDestroy called"); 59 super.onDestroy(); 60 } 61 62 /** 63 * If this service is binded, this method is called. 64 * 65 * @param arg 66 * Intent used when service is called. 67 * @return IBinder. 68 */ 69 @Override 70 public IBinder onBind(final Intent arg) { 71 Log.i(TAG, "onBind called"); 72 return mBinder; 73 } 74} 75