1/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.smspush.unitTests;
18
19import android.app.Service;
20import android.content.Context;
21import android.content.Intent;
22import android.os.IBinder;
23import android.util.Log;
24
25import com.android.internal.util.HexDump;
26
27/**
28 * Service type receiver application
29 */
30public class ReceiverService extends Service {
31    private static final String LOG_TAG = "WAP PUSH";
32
33    @Override
34    public void onCreate() {
35        super.onCreate();
36        Log.d(LOG_TAG, "Receiver service created");
37    }
38
39    @Override
40    public IBinder onBind(Intent intent) {
41        return null;
42    }
43
44    @Override
45    public int onStartCommand(Intent intent, int flags, int startId) {
46        Log.d(LOG_TAG, "Receiver service started");
47
48        byte[] body;
49        byte[] header;
50        body = intent.getByteArrayExtra("data");
51        header = intent.getByteArrayExtra("header");
52
53        Log.d(LOG_TAG, "header:");
54        Log.d(LOG_TAG, HexDump.dumpHexString(header));
55        Log.d(LOG_TAG, "body:");
56        Log.d(LOG_TAG, HexDump.dumpHexString(body));
57
58        DataVerify.SetLastReceivedPdu(body);
59        return START_STICKY;
60    }
61}
62
63
64