what is a list of android internal broadcast? -
i have android application, when user installs , when app run want able start service if device has internet access.
this mainfest.xml content service , broadcast
<receiver android:name="com.google.audiancelistening.wifichangedbrodcast" > <intent-filter> <action android:name="android.net.conn.connectivity_change" /> </intent-filter> </receiver>
for solution when wifi turned on broadcast executes successfully, want start in first of application added below code in activity:
if(isinterneton()){ intent inten = new intent(getapplicationcontext(), connectionservice.class); getapplicationcontext().startservice(inten); writetosdfile(); android.os.process.killprocess(android.os.process.mypid()); } else{ writetosdfile(); android.os.process.killprocess(android.os.process.mypid()); }
isinterneton() method method check internet access below:
public final boolean isinterneton() { connectivitymanager connec = null; connec = (connectivitymanager)getapplicationcontext().getsystemservice(context.connectivity_service); if ( connec != null){ networkinfo result = connec.getnetworkinfo(connectivitymanager.type_mobile); if (result != null && result.isconnectedorconnecting()); return true; } return false; }
but when activity execute , internet first access can not able run , when turn off , on wifi service start , work successfully. :( dont know solution dont have exception.
Comments
Post a Comment