本文整理汇总了Java中android.content.IntentFilter.addCategory方法的典型用法代码示例。如果您正苦于以下问题:Java IntentFilter.addCategory方法的具体用法?Java IntentFilter.addCategory怎么用?Java IntentFilter.addCategory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.IntentFilter
的用法示例。
在下文中一共展示了IntentFilter.addCategory方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initBluetooth
import android.content.IntentFilter; //导入方法依赖的package包/类
public void initBluetooth() {
if (!ensureInit()) {
Log.w("[Bluetooth] Manager tried to init bluetooth but LinphoneService not ready yet...");
return;
}
IntentFilter filter = new IntentFilter();
filter.addCategory(BluetoothHeadset.VENDOR_SPECIFIC_HEADSET_EVENT_COMPANY_ID_CATEGORY + "." + BluetoothAssignedNumbers.PLANTRONICS);
filter.addAction(AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED);
filter.addAction(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED);
filter.addAction(BluetoothHeadset.ACTION_VENDOR_SPECIFIC_HEADSET_EVENT);
mContext.registerReceiver(this, filter);
Log.d("[Bluetooth] Receiver started");
startBluetooth();
}
示例2: onCreate
import android.content.IntentFilter; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
preferencesHelper = PreferencesHelper.getInstance();
IntentFilter filter = new IntentFilter(SyncContentReceiver.SYNC_RESPONSE_STATUS);
filter.addCategory(Intent.CATEGORY_DEFAULT);
syncContentReceiver = new SyncContentReceiver();
registerReceiver(syncContentReceiver, filter);
setupToolBar();
setupCalendarFab();
setupDrawerLayout();
if (savedInstanceState != null) {
currentItem = savedInstanceState.getInt(STATE_SELECTED_POSITION);
isSyncActive = savedInstanceState.getBoolean(STATE_SYNC_ACTIVE);
}
navigationView.getMenu().performIdentifierAction(currentItem, 0);//default main fragment
TvGuideSyncAdapter.initializeSyncAdapter(this);//sync data now
}
示例3: testShowBasicShareDialog
import android.content.IntentFilter; //导入方法依赖的package包/类
public void testShowBasicShareDialog() {
final WritableMap content = new WritableNativeMap();
content.putString("message", "Hello, ReactNative!");
final WritableMap options = new WritableNativeMap();
IntentFilter intentFilter = new IntentFilter(Intent.ACTION_CHOOSER);
intentFilter.addCategory(Intent.CATEGORY_DEFAULT);
ActivityMonitor monitor = getInstrumentation().addMonitor(intentFilter, null, true);
getTestModule().showShareDialog(content, options);
waitForBridgeAndUIIdle();
getInstrumentation().waitForIdleSync();
assertEquals(1, monitor.getHits());
assertEquals(1, mRecordingModule.getOpened());
assertEquals(0, mRecordingModule.getErrors());
}
示例4: isPaperLauncherDefault
import android.content.IntentFilter; //导入方法依赖的package包/类
private boolean isPaperLauncherDefault() {
final IntentFilter filter = new IntentFilter(Intent.ACTION_MAIN);
filter.addCategory(Intent.CATEGORY_HOME);
List<IntentFilter> filters = new ArrayList<>();
filters.add(filter);
String paperLauncherPackageName = mLauncherActivity.getPackageName();
List<ComponentName> activities = new ArrayList<>();
PackageManager packageManager = mLauncherActivity.getPackageManager();
packageManager.getPreferredActivities(filters, activities, null);
for (ComponentName activity : activities) {
if (paperLauncherPackageName.equals(activity.getPackageName())) {
return true;
}
}
return false;
}
示例5: onAttachedToWindow
import android.content.IntentFilter; //导入方法依赖的package包/类
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
IntentFilter filter = new IntentFilter();
filter.addCategory(Intent.ACTION_TIME_TICK);
filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
getContext().registerReceiver(mReceiver, filter);
}
示例6: onCreate
import android.content.IntentFilter; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
IntentFilter filter = new IntentFilter();
filter.addCategory(Intent.CATEGORY_DEFAULT);
filter.addAction(getResources().getString(R.string.activity_intent_filter_action));
registerReceiver(myBroadcastReceiver, filter);
}
示例7: startIntentService
import android.content.IntentFilter; //导入方法依赖的package包/类
public void startIntentService(){
//intentService
intentFilter = new IntentFilter(connect_receiver.PROCESS_RESPONSE);
intentFilter.addCategory(Intent.CATEGORY_DEFAULT);
connect_receiver = new connect_receiver();
registerReceiver(connect_receiver,intentFilter);
Intent service = new Intent(getApplicationContext(), connection_service.class);
startService(service);
}
示例8: startIntentService
import android.content.IntentFilter; //导入方法依赖的package包/类
public void startIntentService(){
//intentService
connect_receiver = new connect_receiver();
intentFilter = new IntentFilter(connect_receiver.PROCESS_RESPONSE);
intentFilter.addCategory(Intent.CATEGORY_DEFAULT);
registerReceiver(connect_receiver,intentFilter);
Intent service = new Intent(getApplicationContext(), connection_service.class);
startService(service);
}
示例9: startIntentService
import android.content.IntentFilter; //导入方法依赖的package包/类
private void startIntentService(){
//intentService
intentFilter = new IntentFilter(connect_receiver.PROCESS_RESPONSE);
intentFilter.addCategory(Intent.CATEGORY_DEFAULT);
connect_receiver = new connect_receiver();
registerReceiver(connect_receiver,intentFilter);
Intent service = new Intent(getApplicationContext(), connection_service.class);
startService(service);
}
示例10: bindReceiver
import android.content.IntentFilter; //导入方法依赖的package包/类
private void bindReceiver(final T view) {
receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
handleIntent(view, intent);
}
};
manager = LocalBroadcastManager.getInstance(context);
final IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_VIEW);
filter.addCategory(Intent.CATEGORY_DEFAULT);
final Uri[] uris = new Uri[kolibriUris().length];
for (int i = 0; i < uris.length; ++i) {
uris[i] = Uri.parse(kolibriUris()[i]);
final Uri uri = uris[i];
filter.addDataScheme(uri.getScheme());
filter.addDataAuthority(uri.getHost(), null);
}
manager.registerReceiver(receiver, filter);
}
示例11: requestPushToken
import android.content.IntentFilter; //导入方法依赖的package包/类
void requestPushToken(Activity activity){
if (activity!=null) {
Intent service = new Intent(activity, RegistrationIntentService.class);
service.putExtra(RegistrationIntentService.TOKEN, "token");
activity.startService(service);
IntentFilter intentFilter = new IntentFilter(RegistrationIntentService.ACTION_TOKEN);
intentFilter.addCategory(Intent.CATEGORY_DEFAULT);
activity.registerReceiver(tokenBroadcastReceiver, intentFilter);
//send back first
sendBroatCast();
}
}
示例12: initReceiver
import android.content.IntentFilter; //导入方法依赖的package包/类
private void initReceiver(){
IntentFilter filter = new IntentFilter();
filter.addAction("com.mpush.MESSAGE_RECEIVED");
filter.addAction("com.mpush.KICK_USER");
filter.addAction("com.mpush.CONNECTIVITY_CHANGE");
filter.addAction("com.mpush.HANDSHAKE_OK");
filter.addAction("com.mpush.BIND_USER");
filter.addAction("com.mpush.UNBIND_USER");
filter.addCategory(reactContext.getPackageName());
reactContext.registerReceiver(this, filter);
}
示例13: OCastMediaRouteProvider
import android.content.IntentFilter; //导入方法依赖的package包/类
public OCastMediaRouteProvider(@NonNull Context context, List<String> searchTargets) {
super(context);
mContext = context.getApplicationContext();
mHandler = new Handler(Looper.getMainLooper());
mActiveDiscovery = new Discovery(searchTargets, callback, DiscoveryReliability.HIGH);
mProcessDiscovery = new Discovery(searchTargets, callback, DiscoveryReliability.LOW);
mCategoryIntentFilterList = new ArrayList<>();
IntentFilter f = new IntentFilter();
f.addCategory(CATEGORY_OCAST);
mCategoryIntentFilterList.add(f);
mConnectivityManager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
mWifiMonitorIntentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
}
示例14: getResponseFilter
import android.content.IntentFilter; //导入方法依赖的package包/类
IntentFilter getResponseFilter() {
IntentFilter filter = new IntentFilter();
filter.addAction(QueryUtil.createResponseAction(mDataType, mQueryId));
filter.addCategory(QueryUtil.BBQ_CATEGORY);
return filter;
}