Skip to content
Browse files

unregister ConnectivityChangedReceiver

  • Loading branch information...
1 parent 7f55ec0 commit f1ba51d5fc047d3edf72ad3747e7d35938d7b18a @Flowdalic committed Aug 26, 2012
Showing with 11 additions and 2 deletions.
  1. +11 −2 static-src/custom/org/jivesoftware/smack/SmackAndroid.java
View
13 static-src/custom/org/jivesoftware/smack/SmackAndroid.java
@@ -12,10 +12,15 @@
public class SmackAndroid {
private static SmackAndroid sSmackAndroid = null;
+ private BroadcastReceiver mConnectivityChangedReceiver;
+ private Context mCtx;
+
private SmackAndroid(Context ctx) {
ConfigureProviderManager.configureProviderManager();
InitStaticCode.initStaticCode(ctx);
- ctx.registerReceiver(new ConnectivtyChangedReciever(), new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
+ mConnectivityChangedReceiver = new ConnectivtyChangedReceiver();
+ ctx.registerReceiver(mConnectivityChangedReceiver, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
+ mCtx = ctx;
}
public static SmackAndroid init(Context ctx) {
@@ -25,7 +30,11 @@ public static SmackAndroid init(Context ctx) {
return sSmackAndroid;
}
- class ConnectivtyChangedReciever extends BroadcastReceiver {
+ public void exit() {
+ mCtx.unregisterReceiver(mConnectivityChangedReceiver);
+ }
+
+ class ConnectivtyChangedReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {

0 comments on commit f1ba51d

Please sign in to comment.
Something went wrong with that request. Please try again.