Skip to content

Instantly share code, notes, and snippets.

@levinotik
Created May 31, 2012 00:25
Show Gist options
  • Save levinotik/2839793 to your computer and use it in GitHub Desktop.
Save levinotik/2839793 to your computer and use it in GitHub Desktop.
<service android:name="com.me.services.MusicService">
<intent-filter>
<action android:name="com.me.action.NOTIFY_WIFI_CHANGE"/>
</intent-filter>
</service>
public void onReceive(Context context, Intent intent) {
Intent notifyIntent = new Intent(MusicService.ACTION_NOTIFY_WIFI_CHANGE);
notifyIntent.putExtra("have_connection", mHaveConnection);
context.startService(intent);
}
and in my MusicService:
public static final String ACTION_NOTIFY_WIFI_CHANGE = "com.me.action.NOTIFY_WIFI_CHANGE;
....
onStartCommand() { ... else if(action.equals(ACTION_NOTIFY_WIFI_CHANGE))handleWifiChange(intent);}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment