omkar_ghaisas
Newbie
Hi,
I am trying to create a broadcastreceiver to listen for the android.net.conn.CONNECTIVITY_CHANGE broadcast.
My broadcastreceiver code is,
whereas in the manifest file, I have,
But after I install this app on my phone and turn on Wifi option, nothing happens. I am assuming the defined activity should be started before the broadcastreceiver completes its onReceive method call ?
Please suggest, if I am doing anything wrong, because I have tried different things like calling a service, showing a toast from the broadcast receiver, but I am doubtful, if my broadcastreceiver is even getting triggered.
Thanks,
Omkar Ghaisas
I am trying to create a broadcastreceiver to listen for the android.net.conn.CONNECTIVITY_CHANGE broadcast.
My broadcastreceiver code is,
Code:
public class wifisyncreceiver extends BroadcastReceiver {
@Override
public void onReceive(Context arg0, Intent arg1) {
arg0.startActivity(new Intent(Settings.ACTION_SYNC_SETTINGS));
}
}
whereas in the manifest file, I have,
Code:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="utility.wifisyncer.wifisync"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<receiver android:name=".receiver.wifisyncreceiver" android:enabled="true">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGED" />
</intent-filter>
</receiver>
</application>
</manifest>
But after I install this app on my phone and turn on Wifi option, nothing happens. I am assuming the defined activity should be started before the broadcastreceiver completes its onReceive method call ?
Please suggest, if I am doing anything wrong, because I have tried different things like calling a service, showing a toast from the broadcast receiver, but I am doubtful, if my broadcastreceiver is even getting triggered.
Thanks,
Omkar Ghaisas