mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-04 23:02:02 +01:00
fix OS warning by unregistering SMS receivers in onDestroy
This commit is contained in:
parent
63ad3a196b
commit
b40533230a
1 changed files with 17 additions and 4 deletions
|
@ -81,6 +81,9 @@ public class SMSService extends XWService {
|
|||
// always one of these. What follows depends.
|
||||
private enum SMS_CMD { NONE, INVITE, DATA, DEATH, ACK, };
|
||||
|
||||
private BroadcastReceiver m_sentReceiver;
|
||||
private BroadcastReceiver m_receiveReceiver;
|
||||
|
||||
private int m_nReceived = 0;
|
||||
private static int s_nSent = 0;
|
||||
private static HashMap<String, HashMap <Integer, MsgStore>> s_partialMsgs
|
||||
|
@ -218,6 +221,14 @@ public class SMSService extends XWService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy()
|
||||
{
|
||||
unregisterReceiver( m_sentReceiver );
|
||||
unregisterReceiver( m_receiveReceiver );
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand( Intent intent, int flags, int startId )
|
||||
{
|
||||
|
@ -646,7 +657,7 @@ public class SMSService extends XWService {
|
|||
|
||||
private void registerReceivers()
|
||||
{
|
||||
registerReceiver( new BroadcastReceiver() {
|
||||
m_sentReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context arg0, Intent arg1)
|
||||
{
|
||||
|
@ -666,9 +677,10 @@ public class SMSService extends XWService {
|
|||
break;
|
||||
}
|
||||
}
|
||||
}, new IntentFilter(MSG_SENT) );
|
||||
};
|
||||
registerReceiver( m_sentReceiver, new IntentFilter(MSG_SENT) );
|
||||
|
||||
registerReceiver( new BroadcastReceiver() {
|
||||
m_receiveReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context arg0, Intent arg1)
|
||||
{
|
||||
|
@ -678,7 +690,8 @@ public class SMSService extends XWService {
|
|||
DbgUtils.logf( "FAILURE!!!" );
|
||||
}
|
||||
}
|
||||
}, new IntentFilter(MSG_DELIVERED) );
|
||||
};
|
||||
registerReceiver( m_receiveReceiver, new IntentFilter(MSG_DELIVERED) );
|
||||
}
|
||||
|
||||
private class SMSMsgSink extends MultiMsgSink {
|
||||
|
|
Loading…
Reference in a new issue