本文整理汇总了Java中android.content.IntentFilter.addDataScheme方法的典型用法代码示例。如果您正苦于以下问题:Java IntentFilter.addDataScheme方法的具体用法?Java IntentFilter.addDataScheme怎么用?Java IntentFilter.addDataScheme使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.IntentFilter
的用法示例。
在下文中一共展示了IntentFilter.addDataScheme方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerApkInstallReceiver
import android.content.IntentFilter; //导入方法依赖的package包/类
public synchronized static void registerApkInstallReceiver(Context context) {
try {
if (context == null) {
return;
}
Context applicationContext = context.getApplicationContext();
if (applicationContext == null) {
return;
}
if (mReceiver != null) {
return;
}
ApkInstallBroadcastReceiver receiver = new ApkInstallBroadcastReceiver();
IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
filter.addDataScheme("package");
applicationContext.registerReceiver(receiver, filter);
mReceiver = receiver;
} catch (Throwable e) {
DLog.e(e);
}
}
示例2: setListening
import android.content.IntentFilter; //导入方法依赖的package包/类
public void setListening(boolean listening) {
if (mListening == listening) return;
mListening = listening;
if (mListening) {
// listen for package changes
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_PACKAGE_ADDED);
filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
filter.addDataScheme("package");
mContext.registerReceiver(mPackageReceiver, filter);
mContentResolver.registerContentObserver(Settings.Secure.getUriFor(mConfig.setting),
false, mSettingsObserver);
} else {
mContext.unregisterReceiver(mPackageReceiver);
mContentResolver.unregisterContentObserver(mSettingsObserver);
}
}
示例3: onCreate
import android.content.IntentFilter; //导入方法依赖的package包/类
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;
}
示例4: onCreate
import android.content.IntentFilter; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
Utils.debugLog(TAG, "creating Service");
localBroadcastManager = LocalBroadcastManager.getInstance(this);
appUpdateStatusManager = AppUpdateStatusManager.getInstance(this);
BroadcastReceiver br = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String packageName = intent.getData().getSchemeSpecificPart();
for (AppUpdateStatusManager.AppUpdateStatus status : appUpdateStatusManager.getByPackageName(packageName)) {
appUpdateStatusManager.updateApk(status.getUniqueKey(), AppUpdateStatusManager.Status.Installed, null);
}
}
};
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
intentFilter.addDataScheme("package");
registerReceiver(br, intentFilter);
}
示例5: setContext
import android.content.IntentFilter; //导入方法依赖的package包/类
private synchronized void setContext(SipService ctxt) {
// If we have a new context, restart bindings
if(service != ctxt) {
// Reset
quit();
// Set new service
service = ctxt;
alarmManager = (AlarmManager) service.getSystemService(Context.ALARM_SERVICE);
wakeLock = new SipWakeLock((PowerManager) ctxt.getSystemService(Context.POWER_SERVICE));
}
if(!serviceRegistered) {
IntentFilter filter = new IntentFilter(TIMER_ACTION);
filter.addDataScheme(EXTRA_TIMER_SCHEME);
service.registerReceiver(this, filter);
serviceRegistered = true;
}
}
示例6: onCreate
import android.content.IntentFilter; //导入方法依赖的package包/类
public void onCreate(Bundle bundle){
super.onCreate(bundle);
mUpdateReceiver = new BroadcastReceiver(){
@Override
public void onReceive(Context context, Intent intent) {
if(intent!=null&& ArchosMediaIntent.ACTION_VIDEO_SCANNER_SCAN_FINISHED.equals(intent.getAction())) {
getLoaderManager().restartLoader(LOADER_ID_LAST_ADDED, null, MainFragment.this);
Log.d(TAG, "manual reload");
}
}
};
mUpdateFilter = new IntentFilter();
for(String scheme : UriUtils.sIndexableSchemes){
mUpdateFilter.addDataScheme(scheme);
}
mUpdateFilter.addAction(ArchosMediaIntent.ACTION_VIDEO_SCANNER_SCAN_FINISHED);
}
示例7: onViewCreated
import android.content.IntentFilter; //导入方法依赖的package包/类
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);
}
示例8: AppLauncher
import android.content.IntentFilter; //导入方法依赖的package包/类
public AppLauncher(Context context, XSharedPreferences prefs) throws Throwable {
mContext = context;
mResources = mContext.getResources();
mPrefs = prefs;
mGbContext = Utils.getGbContext(mContext);
mGbResources = mGbContext.getResources();
mHandler = new Handler();
mPm = mContext.getPackageManager();
mAppSlots = new ArrayList<AppInfo>();
mAppSlots.add(new AppInfo(R.id.quickapp1));
mAppSlots.add(new AppInfo(R.id.quickapp2));
mAppSlots.add(new AppInfo(R.id.quickapp3));
mAppSlots.add(new AppInfo(R.id.quickapp4));
mAppSlots.add(new AppInfo(R.id.quickapp5));
mAppSlots.add(new AppInfo(R.id.quickapp6));
mAppSlots.add(new AppInfo(R.id.quickapp7));
mAppSlots.add(new AppInfo(R.id.quickapp8));
mAppSlots.add(new AppInfo(R.id.quickapp9));
mAppSlots.add(new AppInfo(R.id.quickapp10));
mAppSlots.add(new AppInfo(R.id.quickapp11));
mAppSlots.add(new AppInfo(R.id.quickapp12));
IntentFilter intentFilter = new IntentFilter(Intent.ACTION_PACKAGE_FULLY_REMOVED);
intentFilter.addDataScheme("package");
mContext.registerReceiver(mPackageRemoveReceiver, intentFilter);
}
示例9: onAttach
import android.content.IntentFilter; //导入方法依赖的package包/类
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
IntentFilter intentFilter = new IntentFilter(ExtStorageReceiver.ACTION_MEDIA_MOUNTED);
intentFilter.addAction(ExtStorageReceiver.ACTION_MEDIA_UNMOUNTED);
intentFilter.addAction(ExtStorageReceiver.ACTION_MEDIA_CHANGED);
intentFilter.addDataScheme("file");
intentFilter.addDataScheme(ExtStorageReceiver.ARCHOS_FILE_SCHEME);//new android nougat send UriExposureException when scheme = file
getActivity().registerReceiver(mExternalStorageReceiver, intentFilter);
}
示例10: onStart
import android.content.IntentFilter; //导入方法依赖的package包/类
@Override
public void onStart() {
super.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");
mContext.registerReceiver(receiver, filter);
}
示例11: onCreate
import android.content.IntentFilter; //导入方法依赖的package包/类
@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());
}
示例12: getIntentFilter
import android.content.IntentFilter; //导入方法依赖的package包/类
/**
* Get a prepared {@link IntentFilter} for use for matching this service's action events.
*
* @param urlString The full file URL to match.
*/
public static IntentFilter getIntentFilter(String urlString) {
Uri uri = Uri.parse(urlString);
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Downloader.ACTION_STARTED);
intentFilter.addAction(Downloader.ACTION_PROGRESS);
intentFilter.addAction(Downloader.ACTION_COMPLETE);
intentFilter.addAction(Downloader.ACTION_INTERRUPTED);
intentFilter.addAction(Downloader.ACTION_CONNECTION_FAILED);
intentFilter.addDataScheme(uri.getScheme());
intentFilter.addDataAuthority(uri.getHost(), String.valueOf(uri.getPort()));
intentFilter.addDataPath(uri.getPath(), PatternMatcher.PATTERN_LITERAL);
return intentFilter;
}
示例13: 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);
}
示例14: registerPluginInstalledBroadcastReceiver
import android.content.IntentFilter; //导入方法依赖的package包/类
private void registerPluginInstalledBroadcastReceiver() {
IntentFilter filter = new IntentFilter();
filter.addAction(ApkManager.ACTION_PACKAGE_ADDED);
filter.addDataScheme("package");
LogInfo.log("plugin", "注册广播: com.letv.plugin.pluginloader.PACKAGE_ADDED");
registerReceiver(this.mPluginInstallSuccessReceiver, filter);
}
示例15: onStart
import android.content.IntentFilter; //导入方法依赖的package包/类
@Override
protected void onStart() {
super.onStart();
receiver = new Receiver();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.intent.action.PACKAGE_ADDED");
intentFilter.addAction("android.intent.action.PACKAGE_REMOVED");
intentFilter.addDataScheme("package");
this.registerReceiver(receiver, intentFilter);
}