2 * Copyright (C) 2007-2008 Esmertec AG.
3 * Copyright (C) 2007-2008 The Android Open Source Project
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 package com.android.mms.transaction;
20 import com.android.mms.R;
21 import com.android.mms.ui.ManageSimMessages;
23 import android.app.Notification;
24 import android.app.NotificationManager;
25 import android.app.PendingIntent;
26 import android.content.BroadcastReceiver;
27 import android.content.Context;
28 import android.content.Intent;
29 import android.provider.Settings;
30 import android.provider.Telephony;
33 * Receive Intent.SIM_FULL_ACTION. Handle notification that SIM is full.
35 public class SimFullReceiver extends BroadcastReceiver {
38 public void onReceive(Context context, Intent intent) {
39 if (Settings.Secure.getInt(context.getContentResolver(),
40 Settings.Secure.DEVICE_PROVISIONED, 0) == 1 &&
41 Telephony.Sms.Intents.SIM_FULL_ACTION.equals(intent.getAction())) {
43 NotificationManager nm = (NotificationManager)
44 context.getSystemService(Context.NOTIFICATION_SERVICE);
46 Intent viewSimIntent = new Intent(context, ManageSimMessages.class);
47 viewSimIntent.setAction(Intent.ACTION_VIEW);
48 viewSimIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
49 PendingIntent pendingIntent = PendingIntent.getActivity(
50 context, 0, viewSimIntent, 0);
52 Notification notification = new Notification();
53 notification.icon = R.drawable.stat_sys_no_sim;
54 notification.tickerText = context.getString(R.string.sim_full_title);
55 notification.defaults = Notification.DEFAULT_ALL;
57 notification.setLatestEventInfo(
58 context, context.getString(R.string.sim_full_title),
59 context.getString(R.string.sim_full_body),
61 nm.notify(ManageSimMessages.SIM_FULL_NOTIFICATION_ID, notification);