172735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project/* 272735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project * Copyright (C) 2007-2008 Esmertec AG. 372735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project * Copyright (C) 2007-2008 The Android Open Source Project 472735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project * 572735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License"); 672735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project * you may not use this file except in compliance with the License. 772735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project * You may obtain a copy of the License at 872735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project * 972735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project * http://www.apache.org/licenses/LICENSE-2.0 1072735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project * 1172735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project * Unless required by applicable law or agreed to in writing, software 1272735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS, 1372735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1472735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project * See the License for the specific language governing permissions and 1572735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project * limitations under the License. 1672735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project */ 1772735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project 1872735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Projectpackage com.android.mms.transaction; 1972735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project 2072735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Projectimport android.app.Notification; 2172735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Projectimport android.app.NotificationManager; 2272735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Projectimport android.app.PendingIntent; 2372735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Projectimport android.content.BroadcastReceiver; 2472735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Projectimport android.content.Context; 2572735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Projectimport android.content.Intent; 2672735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Projectimport android.provider.Settings; 27f7e8281a223af6228e6399055a6197a1edd9bc3aTom Taylorimport android.provider.Telephony; 2872735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project 29d64419030e1fec1e751695dab3bd7236e2fb0214Roger Chenimport com.android.mms.R; 30d64419030e1fec1e751695dab3bd7236e2fb0214Roger Chenimport com.android.mms.ui.ManageSimMessages; 31d64419030e1fec1e751695dab3bd7236e2fb0214Roger Chen 3272735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project/** 3372735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project * Receive Intent.SIM_FULL_ACTION. Handle notification that SIM is full. 3472735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project */ 3572735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Projectpublic class SimFullReceiver extends BroadcastReceiver { 366be18bedb5b87dbbcdb54f37d5a0945bd0f71377Tom Taylor 3772735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project @Override 3872735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project public void onReceive(Context context, Intent intent) { 398b4521b61b8ff87f2a3a13850eaa13d8e8901174Jeff Brown if (Settings.Global.getInt(context.getContentResolver(), 408b4521b61b8ff87f2a3a13850eaa13d8e8901174Jeff Brown Settings.Global.DEVICE_PROVISIONED, 0) == 1 && 41f7e8281a223af6228e6399055a6197a1edd9bc3aTom Taylor Telephony.Sms.Intents.SIM_FULL_ACTION.equals(intent.getAction())) { 426be18bedb5b87dbbcdb54f37d5a0945bd0f71377Tom Taylor 4372735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project NotificationManager nm = (NotificationManager) 4472735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project context.getSystemService(Context.NOTIFICATION_SERVICE); 4572735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project 4672735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project Intent viewSimIntent = new Intent(context, ManageSimMessages.class); 4772735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project viewSimIntent.setAction(Intent.ACTION_VIEW); 4872735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project viewSimIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 4972735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project PendingIntent pendingIntent = PendingIntent.getActivity( 5072735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project context, 0, viewSimIntent, 0); 5172735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project 5272735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project Notification notification = new Notification(); 5372735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project notification.icon = R.drawable.stat_sys_no_sim; 5472735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project notification.tickerText = context.getString(R.string.sim_full_title); 5572735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project notification.defaults = Notification.DEFAULT_ALL; 566be18bedb5b87dbbcdb54f37d5a0945bd0f71377Tom Taylor 5772735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project notification.setLatestEventInfo( 586be18bedb5b87dbbcdb54f37d5a0945bd0f71377Tom Taylor context, context.getString(R.string.sim_full_title), 5972735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project context.getString(R.string.sim_full_body), 6072735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project pendingIntent); 6172735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project nm.notify(ManageSimMessages.SIM_FULL_NOTIFICATION_ID, notification); 6272735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project } 6372735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project } 6472735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project 6572735c62aba8fd2a9420a0f9f83d22543e3c164fThe Android Open Source Project} 66