本文整理匯總了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);
}