Java Code Examples for android.content.IntentFilter#addDataScheme()
The following examples show how to use
android.content.IntentFilter#addDataScheme() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WeChatDecorator.java From decorator-wechat with Apache License 2.0 | 6 votes |
@Override public void onCreate() { super.onCreate(); final Context context = SDK_INT >= N ? createDeviceProtectedStorageContext() : this; //noinspection deprecation mPreferences = context.getSharedPreferences(PREFERENCES_NAME, MODE_MULTI_PROCESS); migrateFromLegacyPreferences(); // TODO: Remove this IO-blocking migration code (created in Aug, 2019). mPrefKeyWear = getString(R.string.pref_wear); mMessagingBuilder = new MessagingBuilder(this, new MessagingBuilder.Controller() { @Override public void recastNotification(final String key, final Bundle addition) { WeChatDecorator.this.recastNotification(key, addition); } @Override public Conversation getConversation(final int id) { return mConversationManager.getConversation(id); } }); // Must be called after loadPreferences(). final IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_REMOVED); filter.addDataScheme("package"); registerReceiver(mPackageEventReceiver, filter); registerReceiver(mSettingsChangedReceiver, new IntentFilter(ACTION_SETTINGS_CHANGED)); }
Example 2
Source File: DiskManagerService.java From astrobee_android with Apache License 2.0 | 6 votes |
@Override public void onCreate() { super.onCreate(); // TODO Detect -somehow- new adopted storage on running time // Create and configure a broadcast receiver. br = new MyBroadcastReceiver(); IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_MEDIA_MOUNTED); filter.addAction(Intent.ACTION_MEDIA_REMOVED); filter.addDataScheme("file"); this.registerReceiver(br, filter); // Detect storage devices on this android terminal loadStorage(); // Handler for interface updating this.handler = new Handler(); this.handler.post(refresh); // Control messages Toaster.toast("DISK Service & Publisher RUNNING"); Log.i("LOG", "ONCREATE FINISHED!"); }
Example 3
Source File: MainActivity.java From android-overlay-protection with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(Intent.ACTION_PACKAGE_ADDED); intentFilter.addAction(Intent.ACTION_PACKAGE_REMOVED); intentFilter.addDataScheme("package"); registerReceiver(_packageUpdateReceiver, intentFilter); mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager().findFragmentById(R.id.navigation_drawer); mTitle = getTitle(); // Set up the drawer. mNavigationDrawerFragment.setUp( R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); restoreActionBar(); DatabaseUtils.fillSuspectedApps(this); }
Example 4
Source File: S_MVP.java From styT with Apache License 2.0 | 6 votes |
public void onCreate() { // myLog.l(Log.DEBUG, "SwiFTP server created"); // Set the application-wide context global, if not already set Context myContext = Globals.getContext(); if (myContext == null) { myContext = getApplicationContext(); if (myContext != null) { Globals.setContext(myContext); } } IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED); intentFilter.addDataScheme("file"); registerReceiver(mReceiver, intentFilter); return; }
Example 5
Source File: TopRecommendFragment.java From letv with Apache License 2.0 | 6 votes |
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); selectedType = 0; this.exchid = "2"; this.isFirst = true; this.currentPage = 1; this.currentPage2 = 1; this.currentPage3 = 1; findView(); this.inBootReciever = new BootReciever(this); IntentFilter filter = new IntentFilter(); filter.addAction("android.intent.action.PACKAGE_ADDED"); filter.addAction("android.intent.action.PACKAGE_REMOVED"); filter.addDataScheme("package"); getActivity().registerReceiver(this.inBootReciever, filter); }
Example 6
Source File: PatientsList.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 5 votes |
public IntentFilter buildFilter() { Log.i(TAG, "buildFilter()"); IntentFilter filter = new IntentFilter(Response.RESPONSE); filter.addDataScheme(Subjects.CONTENT_URI.getScheme()); try { filter.addDataType(Subjects.CONTENT_TYPE); filter.addDataType(Subjects.CONTENT_ITEM_TYPE); } catch (IntentFilter.MalformedMimeTypeException e) { } return filter; }
Example 7
Source File: MainLoader.java From Android-Applications-Info with Apache License 2.0 | 5 votes |
public PackageIntentReceiver(MainLoader loader) { mLoader = loader; IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED); filter.addAction(Intent.ACTION_PACKAGE_REMOVED); filter.addAction(Intent.ACTION_PACKAGE_CHANGED); filter.addDataScheme("package"); mLoader.getContext().registerReceiver(this, filter); // Register for events related to sdcard installation. IntentFilter sdFilter = new IntentFilter(); sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE); sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE); filter.addAction(Intent.ACTION_LOCALE_CHANGED); mLoader.getContext().registerReceiver(this, sdFilter); }
Example 8
Source File: SampleTest.java From androidtestdebug with MIT License | 5 votes |
public void test点击链接() { final Instrumentation inst = getInstrumentation(); IntentFilter intentFilter = new IntentFilter(Intent.ACTION_VIEW); intentFilter.addDataScheme("http"); intentFilter.addCategory(Intent.CATEGORY_BROWSABLE); View link = this.getActivity().findViewById(R.id.link); ActivityMonitor monitor = inst.addMonitor( intentFilter, null, false); assertEquals(0, monitor.getHits()); TouchUtils.clickView(this, link); monitor.waitForActivityWithTimeout(5000); assertEquals(1, monitor.getHits()); inst.removeMonitor(monitor); }
Example 9
Source File: LogcatRecordingService.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
@Override public void onCreate() { super.onCreate(); log.d("onCreate()"); IntentFilter intentFilter = new IntentFilter(ACTION_STOP_RECORDING); intentFilter.addDataScheme(URI_SCHEME); registerReceiver(receiver, intentFilter); handler = new Handler(Looper.getMainLooper()); }
Example 10
Source File: AppUninstall.java From android-tv-launcher with MIT License | 5 votes |
@Override protected void onStart() { super.onStart(); Log.i(TAG, "============onStart========"); receiver = new Receiver(); IntentFilter filter = new IntentFilter(); filter.addAction("android.intent.action.PACKAGE_ADDED"); filter.addAction("android.intent.action.PACKAGE_REMOVED"); filter.addDataScheme("package"); this.registerReceiver(receiver, filter); }
Example 11
Source File: LogcatRecordingService.java From javaide with GNU General Public License v3.0 | 5 votes |
@Override public void onCreate() { super.onCreate(); log.d("onCreate()"); IntentFilter intentFilter = new IntentFilter(ACTION_STOP_RECORDING); intentFilter.addDataScheme(URI_SCHEME); registerReceiver(receiver, intentFilter); handler = new Handler(Looper.getMainLooper()); }
Example 12
Source File: ContentService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
ContentService(Context context, boolean factoryTest) { mContext = context; mFactoryTest = factoryTest; // Let the package manager query for the sync adapters for a given authority // as we grant default permissions to sync adapters for specific authorities. PackageManagerInternal packageManagerInternal = LocalServices.getService( PackageManagerInternal.class); packageManagerInternal.setSyncAdapterPackagesprovider( new PackageManagerInternal.SyncAdapterPackagesProvider() { @Override public String[] getPackages(String authority, int userId) { return getSyncAdapterPackagesForAuthorityAsUser(authority, userId); } }); final IntentFilter packageFilter = new IntentFilter(); packageFilter.addAction(Intent.ACTION_PACKAGE_ADDED); packageFilter.addAction(Intent.ACTION_PACKAGE_CHANGED); packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED); packageFilter.addAction(Intent.ACTION_PACKAGE_DATA_CLEARED); packageFilter.addDataScheme("package"); mContext.registerReceiverAsUser(mCacheReceiver, UserHandle.ALL, packageFilter, null, null); final IntentFilter localeFilter = new IntentFilter(); localeFilter.addAction(Intent.ACTION_LOCALE_CHANGED); mContext.registerReceiverAsUser(mCacheReceiver, UserHandle.ALL, localeFilter, null, null); }
Example 13
Source File: ApplicationStateListener.java From product-emm with Apache License 2.0 | 5 votes |
@Override public void startListening() { IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(Intent.ACTION_PACKAGE_ADDED); intentFilter.addAction(Intent.ACTION_PACKAGE_REMOVED); intentFilter.addAction(Intent.ACTION_PACKAGE_REPLACED); intentFilter.addAction(Intent.ACTION_PACKAGE_DATA_CLEARED); intentFilter.addDataScheme("package"); EventRegistry.context.registerReceiver(this, intentFilter); }
Example 14
Source File: ApplicationsReceiver.java From KAM with GNU General Public License v3.0 | 5 votes |
public ApplicationsReceiver(AppsLoader loader) { mLoader = loader; IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED); filter.addAction(Intent.ACTION_PACKAGE_REMOVED); filter.addAction(Intent.ACTION_PACKAGE_CHANGED); filter.addDataScheme("package"); mLoader.getContext().registerReceiver(this, filter); IntentFilter sdFilter = new IntentFilter(); sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE); sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE); mLoader.getContext().registerReceiver(this, sdFilter); }
Example 15
Source File: DocumentsApplication.java From FireFiles with Apache License 2.0 | 5 votes |
@Override public void onCreate() { super.onCreate(); if(!BuildConfig.DEBUG) { AnalyticsManager.intialize(getApplicationContext()); } sInstance = this; final ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); final int memoryClassBytes = am.getMemoryClass() * 1024 * 1024; mRoots = new RootsCache(this); mRoots.updateAsync(); mSAFManager = new SAFManager(this); mThumbnails = new ThumbnailCache(memoryClassBytes / 4); final IntentFilter packageFilter = new IntentFilter(); packageFilter.addAction(Intent.ACTION_PACKAGE_ADDED); packageFilter.addAction(Intent.ACTION_PACKAGE_CHANGED); packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED); packageFilter.addAction(Intent.ACTION_PACKAGE_DATA_CLEARED); packageFilter.addDataScheme("package"); registerReceiver(mCacheReceiver, packageFilter); final IntentFilter localeFilter = new IntentFilter(); localeFilter.addAction(Intent.ACTION_LOCALE_CHANGED); registerReceiver(mCacheReceiver, localeFilter); isTelevision = Utils.isTelevision(this); }
Example 16
Source File: VideoModule.java From Camera2 with Apache License 2.0 | 5 votes |
private void installIntentFilter() { // install an intent filter to receive SD card related events. IntentFilter intentFilter = new IntentFilter(Intent.ACTION_MEDIA_EJECT); intentFilter.addAction(Intent.ACTION_MEDIA_SCANNER_STARTED); intentFilter.addDataScheme("file"); mReceiver = new MyBroadcastReceiver(); mActivity.registerReceiver(mReceiver, intentFilter); }
Example 17
Source File: LoaderCustomSupport.java From V.FlyoutTest with MIT License | 5 votes |
public PackageIntentReceiver(AppListLoader loader) { mLoader = loader; IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED); filter.addAction(Intent.ACTION_PACKAGE_REMOVED); filter.addAction(Intent.ACTION_PACKAGE_CHANGED); filter.addDataScheme("package"); mLoader.getContext().registerReceiver(this, filter); // Register for events related to sdcard installation. IntentFilter sdFilter = new IntentFilter(); sdFilter.addAction(IntentCompat.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE); sdFilter.addAction(IntentCompat.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE); mLoader.getContext().registerReceiver(this, sdFilter); }
Example 18
Source File: IntentFilterDB.java From soot-infoflow-android-iccta with GNU Lesser General Public License v2.1 | 4 votes |
public IntentFilter toIntentFilter(int type) { if (1 == type) { return toIntentFilter(); } IntentFilter filter = toIntentFilter(); try { //for mimetype if (type >= 1) { if (! StringUtil.isEmpty(dataAndType.getType())) { if (! StringUtil.isEmpty(dataAndType.getSubtype())) { filter.addDataType(dataAndType.getType() + "/" + dataAndType.getSubtype()); filterType = 2; } else { filter.addDataType(dataAndType.getType()); filterType = 2; } } } //for data if (type >= 2) { if (! StringUtil.isEmpty(dataAndType.getHost())) { if (! StringUtil.isEmpty(dataAndType.getPort())) { filter.addDataAuthority(dataAndType.getHost(), dataAndType.getPort()); } else { filter.addDataAuthority(dataAndType.getHost(), null); } filterType = 3; } if (! StringUtil.isEmpty(dataAndType.getPath())) { filter.addDataPath(dataAndType.getPath(), PatternMatcher.PATTERN_LITERAL); filterType = 3; } if (! StringUtil.isEmpty(dataAndType.getScheme())) { filter.addDataScheme(dataAndType.getScheme()); filterType = 3; } } } catch (Exception ex) { ex.printStackTrace(); } return filter; }
Example 19
Source File: FailoverTextToSpeech.java From talkback with Apache License 2.0 | 4 votes |
public MediaMountStateMonitor() { mMediaIntentFilter = new IntentFilter(); mMediaIntentFilter.addAction(Intent.ACTION_MEDIA_MOUNTED); mMediaIntentFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED); mMediaIntentFilter.addDataScheme("file"); }
Example 20
Source File: ServiceVPN.java From InviZible with GNU General Public License v3.0 | 4 votes |
@Override public void onCreate() { notificationManager = (NotificationManager) this.getSystemService(NOTIFICATION_SERVICE); Log.i(LOG_TAG, "VPN Create version=" + Util.getSelfVersionName(this) + "/" + Util.getSelfVersionCode(this)); Util.canFilterAsynchronous(this); if (jni_context != 0) { Log.w(LOG_TAG, "VPN Create with context=" + jni_context); jni_stop(jni_context); synchronized (jni_lock) { jni_done(jni_context); jni_context = 0; } } // Native init jni_context = jni_init(Build.VERSION.SDK_INT); Log.i(LOG_TAG, "VPN Created context=" + jni_context); super.onCreate(); HandlerThread commandThread = new HandlerThread(getString(R.string.app_name) + " command", Process.THREAD_PRIORITY_FOREGROUND); commandThread.start(); commandLooper = commandThread.getLooper(); commandHandler = ServiceVPNHandler.getInstance(commandLooper, this); // Listen for idle mode state changes if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { IntentFilter ifIdle = new IntentFilter(); ifIdle.addAction(PowerManager.ACTION_DEVICE_IDLE_MODE_CHANGED); registerReceiver(idleStateReceiver, ifIdle); registeredIdleState = true; } // Listen for added/removed applications IntentFilter ifPackage = new IntentFilter(); ifPackage.addAction(Intent.ACTION_PACKAGE_ADDED); ifPackage.addAction(Intent.ACTION_PACKAGE_REMOVED); ifPackage.addDataScheme("package"); registerReceiver(packageChangedReceiver, ifPackage); registeredPackageChanged = true; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { try { listenNetworkChanges(); } catch (Throwable ex) { Log.w(LOG_TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); listenConnectivityChanges(); } } else { listenConnectivityChanges(); } }