本文整理汇总了Java中android.content.IntentFilter.setPriority方法的典型用法代码示例。如果您正苦于以下问题:Java IntentFilter.setPriority方法的具体用法?Java IntentFilter.setPriority怎么用?Java IntentFilter.setPriority使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.IntentFilter
的用法示例。
在下文中一共展示了IntentFilter.setPriority方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import android.content.IntentFilter; //导入方法依赖的package包/类
private void init() {
LogUtil.i("init service");
/*
* 动态注册广播
* */
mSmsReceiver = new SmsReceiver();
IntentFilter intentFilter = new IntentFilter();
//添加Action
intentFilter.addAction(StaticClass.SMS_ACTION);
//设置优先级,谷歌优先级最大值为1000,这里我设置为int的最大值
intentFilter.setPriority(Integer.MAX_VALUE);
//注册
registerReceiver(mSmsReceiver, intentFilter);
mHomeWatchReceiver = new HomeWatchReceiver();
IntentFilter intentFilter1 = new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
registerReceiver(mHomeWatchReceiver, intentFilter1);
}
示例2: registerReveicer
import android.content.IntentFilter; //导入方法依赖的package包/类
public void registerReveicer() {
registerReceiver(netWorkChangeReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
IntentFilter inf = new IntentFilter(Intent.ACTION_SCREEN_OFF);
inf.addAction(Intent.ACTION_SCREEN_ON);
registerReceiver(scrennReceiver, inf);
registerReceiver(headSetInReceiver, new IntentFilter("android.intent.action.HEADSET_PLUG"));
IntentFilter bit = new IntentFilter(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED);
// bit.addAction(AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED);
//bit.addAction(BluetoothHeadset.ACTION_VENDOR_SPECIFIC_HEADSET_EVENT);
registerReceiver(blueConnectStateBroadcastReceiver, bit);
IntentFilter smsFilter = new IntentFilter(SMS_RECEIVED_ACTION);
smsFilter.setPriority(2147483647);
smsFilter.addAction(GSM_SMS_RECEIVED_ACTION);
registerReceiver(smsReceiver, smsFilter);
}
示例3: initReceiver
import android.content.IntentFilter; //导入方法依赖的package包/类
private void initReceiver() {
IntentFilter intentFilter = new IntentFilter(Constant.NEW_MESSAGE_ACTION);
// 这里设置优先级要比ChatActivity低,聊天界面一旦接受到消息,这里就不需要再接受
intentFilter.setPriority(10);
// 聊天消息的监听
registerReceiver(mReceiver = new NewMessageReceiver(), new IntentFilter(Constant.NEW_MESSAGE_ACTION));
IntentFilter filter = new IntentFilter();
// 说说消息接受
filter.addAction(Constant.NEW_SHARE_MESSAGE_ACTION);
// 说说消息改变实时监听
filter.addAction(Constant.NOTIFY_CHANGE_ACTION);
registerReceiver(shareReceiver = new ShareMessageReceiver(), filter);
// 网络状态改变监听
registerReceiver(netWorkReceiver = new NetWorkChangedReceiver(), new IntentFilter(Constant.NETWORK_CONNECTION_CHANGE));
netWorkReceiver.registerListener(this);
// 单聊和系统推送消息监听
PushMessageReceiver.registerListener(this);
}
示例4: registerReceiver
import android.content.IntentFilter; //导入方法依赖的package包/类
/**
* 去电时:
* 未接:phone_state=OFFHOOK;
* 挂断:phone_state=IDLE
* 来电时:
* 未接:phone_state=RINGING
* 已接:phone_state=OFFHOOK;
* 挂断:phone_state=IDLE
*/
//public void registerCallStateListener(Context context, PhoneStateListener listener) {
// try {
// //获取电话通讯服务
// TelephonyManager tpm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
// tpm.listen(listener, PhoneStateListener.LISTEN_CALL_STATE);
// } catch (Exception e) {
// e.printStackTrace();
// }
//}
public void registerReceiver(Context context, PhoneListener phoneListener) {
try {
IntentFilter filter = new IntentFilter();
filter.addAction("android.intent.action.PHONE_STATE");
filter.addAction("android.intent.action.NEW_OUTGOING_CALL");
filter.setPriority(Integer.MAX_VALUE);
context.registerReceiver(this, filter);
this.phoneListener = phoneListener;
} catch (Exception e) {
e.printStackTrace();
}
}
示例5: pairIntentFilter
import android.content.IntentFilter; //导入方法依赖的package包/类
private static IntentFilter pairIntentFilter() {
final IntentFilter intentFilter = new IntentFilter();
/* reserved for other usages */
/*
intentFilter.addAction(BluetoothDevice.ACTION_FOUND);
intentFilter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
intentFilter.addAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED);
intentFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
intentFilter.addAction(BluetoothDevice.ACTION_PAIRING_REQUEST);
*/
intentFilter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
intentFilter.addAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED);
intentFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
intentFilter.addAction(BluetoothDevice.ACTION_PAIRING_REQUEST);
intentFilter.addAction("com.bluetooth.device.action.FOUND");
intentFilter.setPriority(Integer.MAX_VALUE);
return intentFilter;
}
示例6: registerReceiver
import android.content.IntentFilter; //导入方法依赖的package包/类
public void registerReceiver(Context context, TimeListener timeListener) {
try {
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_TIME_CHANGED);
filter.addAction(Intent.ACTION_TIME_TICK);
filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
filter.setPriority(Integer.MAX_VALUE);
context.registerReceiver(this, filter);
this.timeListener = timeListener;
} catch (Exception e) {
e.printStackTrace();
}
}
示例7: registerForCompletedNotification
import android.content.IntentFilter; //导入方法依赖的package包/类
private void registerForCompletedNotification() {
IntentFilter filter = new IntentFilter();
filter.addAction(ApplicationMigrationService.COMPLETED_ACTION);
filter.setPriority(1000);
registerReceiver(completedReceiver, filter);
}
示例8: initData
import android.content.IntentFilter; //导入方法依赖的package包/类
@Override
public void initData() {
from = getIntent().getStringExtra("from");
if (from.equals("person")) {
user = (User) getIntent().getSerializableExtra("user");
uid = user.getObjectId();
} else if (from.equals("group")) {
groupId = getIntent().getStringExtra("groupId");
mGroupTableMessage = MessageCacheManager.getInstance().getGroupTableMessage(groupId);
}
initActionBar();
// 声音音量变化图片资源
voiceImageId = new int[]{R.mipmap.chat_icon_voice1, R.mipmap.chat_icon_voice2, R.mipmap.chat_icon_voice3, R.mipmap.chat_icon_voice4,
R.mipmap.chat_icon_voice5, R.mipmap.chat_icon_voice6};
initRecordManager();
initEmotionInfo();
mLinearLayoutManager = new LinearLayoutManager(this);
display.setLayoutManager(mLinearLayoutManager);
// display.setHasFixedSize(true);
display.setItemAnimator(new DefaultItemAnimator());
// mAdapter = new ChatAdapter(this, null);
mAdapter = new ChatMessageAdapter();
mAdapter.setOnItemClickListener(this);
display.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
hideSoftInpuutView();
}
}
});
display.setAdapter(mAdapter);
IntentFilter intentFilter = new IntentFilter(Constant.NEW_MESSAGE_ACTION);
intentFilter.setPriority(20);
registerReceiver(mReceiver, intentFilter);
refreshData();
scrollToBottom();
registerRxBus();
}
示例9: registerMessageReceiver
import android.content.IntentFilter; //导入方法依赖的package包/类
public void registerMessageReceiver() {
mMessageReceiver = new MessageReceiver();
IntentFilter filter = new IntentFilter();
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
filter.addAction(MESSAGE_RECEIVED_ACTION);
LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver, filter);
}
示例10: registerSmsReceiver
import android.content.IntentFilter; //导入方法依赖的package包/类
public void registerSmsReceiver(Context context, SmsListener smsListener) {
try {
this.smsListener = smsListener;
IntentFilter filter = new IntentFilter();
filter.addAction("android.provider.Telephony.SMS_RECEIVED");
filter.setPriority(Integer.MAX_VALUE);
context.registerReceiver(this, filter);
} catch (Exception e) {
e.printStackTrace();
}
}
示例11: onResume
import android.content.IntentFilter; //导入方法依赖的package包/类
@Override
protected void onResume() {
super.onResume();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
mStateReceiver = new NetworkStateReceiver();
registerReceiver(mStateReceiver, intentFilter);
IntentFilter intentFilter1 = new IntentFilter();
intentFilter1.addAction(UpdateService.ACTION_SHOW_NOTIFICATION);
intentFilter1.setPriority(100);
mNotificationReceiver = new NotificationReceiver();
registerReceiver(mNotificationReceiver, intentFilter1, UpdateService.PERM_PRIVATE, null);
}
示例12: init
import android.content.IntentFilter; //导入方法依赖的package包/类
private void init()
{
//完成广播接收器要注册的广播
IntentFilter intentFilter=new IntentFilter();
intentFilter.addAction(StaticClass.SMS_ACTION);
intentFilter.setPriority(Integer.MAX_VALUE);//设置优先级
//为广播接收器注册广播
smsReceiver= new SmsReceiver();
registerReceiver(smsReceiver,intentFilter);
L.i("广播接收器已注册");
}
示例13: onResume
import android.content.IntentFilter; //导入方法依赖的package包/类
@Override
protected void onResume() {
super.onResume();
// Register broadcast receiver for notifications
IntentFilter intentFilter = new IntentFilter(UpdateService.BROADCAST_UPDATE_FINISHED);
intentFilter.setPriority(UpdateService.BROADCAST_PRIORITY_UI);
registerReceiver(updateReceiver, intentFilter);
}
示例14: ReceiverBluetooth
import android.content.IntentFilter; //导入方法依赖的package包/类
/*******蓝牙相关*********/
public void ReceiverBluetooth() {
IntentFilter filter = new IntentFilter();
//发现设备
filter.addAction(BluetoothDevice.ACTION_FOUND);
//设备连接状态改变
filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
filter.addAction(ACTION_PAIRING_REQUEST);
filter.setPriority(1000);
//蓝牙设备状态改变
filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
this.registerReceiver(mBluetoothReceiver, filter);
}
示例15: registerMessageReceiver
import android.content.IntentFilter; //导入方法依赖的package包/类
public void registerMessageReceiver() {
mMessageReceiver = new MessageReceiver();
IntentFilter filter = new IntentFilter();
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
filter.addAction(MESSAGE_RECEIVED_ACTION);
registerReceiver(mMessageReceiver, filter);
}