java - 'A resource was acquired at attached stack trace but never released ' error when a receiver is starting an IntentService -
i have broadcastreceiver
calls intentservice
. getting following error when receiver code finished running.
error 'a resource acquired @ attached stack trace never released. see java.io.closeable information on avoiding resource leaks. java.lang.throwable: explicit termination method 'release' not called'
here code:
public class restartreceiver extends broadcastreceiver { private static final string tag = "restartreceiver"; @override public void onreceive(context context, intent intent) { android.os.debug.waitfordebugger(); connectivitymanager connmgr = (connectivitymanager) context.getsystemservice(context.connectivity_service); final networkinfo wifi = connmgr.getnetworkinfo(connectivitymanager.type_wifi); final networkinfo mobile = connmgr.getnetworkinfo(connectivitymanager.type_mobile); if (wifi.isconnected() || mobile.isconnected()) { intent downloadintent=new intent(context,downloadservice.class); context.startservice(downloadintent); } else { toast.maketext(context, "no network connectivity", toast.length_short).show(); } } }
Comments
Post a Comment