Forums - Android SDK leaking OnboardingManager$WifiReceiver

2 posts / 0 new
Last post
Android SDK leaking OnboardingManager$WifiReceiver
Pinball Wizard
Join Date: 14 Apr 15
Posts: 50
Posted: Fri, 2015-10-30 15:56

Seeing this in my logs:

android.app.IntentReceiverLeaked: Activity StreamDetailActivity has leaked IntentReceiver com.qualcomm.qce.allplay.controllersdk.OnboardingManager$WifiReceiver@a4e6e97 that was originally registered here. Are you missing a call to unregisterReceiver()?

I know I need to unregister in OnPause() and re-register on OnResume(), but I am trying to work out EXACTLY what I need to do this on.  I can't actually see any broadcast recievers I am using.    Is this possibly something the SDK should be doing?

I am seeing similar behaviour in the demo app.


Thank You.
 

 

  • Up0
  • Down0
daniel.tai Moderator
Join Date: 19 Oct 15
Location: San Jose
Posts: 32
Posted: Mon, 2015-11-02 12:24

Hi Pinball Wizard,

Thanks for your discovery.  Yes, this receiver is AllPlay's.  This receiver is dynamically registered when AllPlay starts.  It detects Wi-Fi changes and provide the best discovery performance.  The demo app was suppose to be a simple app, so it just initializes AllPlay in the AudioFragment.java, and AudioActivity.java.  It passes in the Activity Context to initialize AllPlay, which register this BroadcastReceiver, so when the activity got destroyed, you see the leak error message.  

I apologize the for the poor Documentation, but AllPlay SDK should really be initialized in your Application class and have an interface to link your context and acitvity/fragment together if you need to know about AllPlay in different activities and fragments.  If you just want to keep AllPlay in a single activity, then it may be best to call stop() when activity is destroyed.  You can also pass in the Application Context during init() if you don't want to stop it. So in the demo app,

mAllPlayController.init("Local Audio Demo", true, mActivity.getApplicationContext());

This will use the Application Context to register, which will be active until the app is closed or killed (Kind of the same if SDK is initialized in your Application class)

Thanks

Daniel

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.