use of android.content.IntentFilter in project cw-omnibus by commonsguy.
the class RemoteViewsHostActivity method onResume.
@Override
public void onResume() {
super.onResume();
IntentFilter pluginFilter = new IntentFilter();
pluginFilter.addAction(ACTION_REGISTER_PLUGIN);
pluginFilter.addAction(ACTION_DELIVER_CONTENT);
registerReceiver(plugin, pluginFilter, PERM_ACT_AS_PLUGIN, null);
if (pluginCN == null) {
sendBroadcast(new Intent(ACTION_CALL_FOR_PLUGINS));
}
}
use of android.content.IntentFilter in project PlayerHater by chrisrhoden.
the class BroadcastReceiver method register.
public static void register(Context context) {
BroadcastReceiver receiver = new BroadcastReceiver();
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_HEADSET_PLUG);
filter.addAction(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
filter.addAction(Intent.ACTION_MEDIA_BUTTON);
filter.setPriority(10000);
context.registerReceiver(receiver, filter);
sInstance = receiver;
}
use of android.content.IntentFilter in project cw-omnibus by commonsguy.
the class EventLogFragment method onStart.
@Override
public void onStart() {
super.onStart();
IntentFilter filter = new IntentFilter(ACTION_EVENT);
LocalBroadcastManager.getInstance(getActivity()).registerReceiver(onEvent, filter);
}
use of android.content.IntentFilter in project cw-omnibus by commonsguy.
the class BatteryFragment method onStart.
@Override
public void onStart() {
super.onStart();
IntentFilter f = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
getActivity().registerReceiver(onBattery, f);
}
use of android.content.IntentFilter in project qksms by moezbhatti.
the class Transaction method sendMMS.
private void sendMMS(final byte[] bytesToSend) {
revokeWifi(true);
// enable mms connection to mobile data
mConnMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
int result = beginMmsConnectivity();
if (LOCAL_LOGV)
Log.v(TAG, "result of connectivity: " + result + " ");
if (result != 0) {
// if mms feature is not already running (most likely isn't...) then register a receiver and wait for it to be active
IntentFilter filter = new IntentFilter();
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
final BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context1, Intent intent) {
String action = intent.getAction();
if (!action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
return;
}
@SuppressWarnings("deprecation") NetworkInfo mNetworkInfo = intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO);
if ((mNetworkInfo == null) || (mNetworkInfo.getType() != ConnectivityManager.TYPE_MOBILE)) {
return;
}
if (!mNetworkInfo.isConnected()) {
return;
} else {
// ready to send the message now
if (LOCAL_LOGV)
Log.v(TAG, "sending through broadcast receiver");
alreadySending = true;
sendData(bytesToSend);
context.unregisterReceiver(this);
}
}
};
context.registerReceiver(receiver, filter);
try {
Looper.prepare();
} catch (Exception e) {
// Already on UI thread probably
}
// try sending after 3 seconds anyways if for some reason the receiver doesn't work
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (!alreadySending) {
try {
if (LOCAL_LOGV)
Log.v(TAG, "sending through handler");
context.unregisterReceiver(receiver);
} catch (Exception e) {
}
sendData(bytesToSend);
}
}
}, 7000);
} else {
// mms connection already active, so send the message
if (LOCAL_LOGV)
Log.v(TAG, "sending right away, already ready");
sendData(bytesToSend);
}
}
Aggregations