//判断BroadCastReceiver是否存在
		PackageManager manager =  getPackageManager();
		//要查找的BroadCastReceiver
		Intent intent = new Intent("com.xiaoqiu.Action.XXXXX");
		
		List<ResolveInfo> resolveInfos = manager.queryBroadcastReceivers(intent, 
				PackageManager.GET_INTENT_FILTERS);
		
		if (resolveInfos.size() == 0) {
			Log.d("debug", "该BroadCast不存在");
		}
		
		//判断包含某个Action的Activity的应用已经安装
		Intent i = new Intent("com.xiaoqiu.phone.action.WAKAKA");
		List<ResolveInfo> resolveInfos1 = manager.queryIntentActivities(intent, 
				PackageManager.GET_INTENT_FILTERS);
		if (resolveInfos.size() == 0) {
			Log.d("debug", "该应用没有安装");
		}
		
		//判断AIDL Service是否存在
		if (!bindService(new Intent("com.xiaoqiu.service"), serviceConnection, Context.BIND_AUTO_CREATE))
		{
			Log.d("debug", "不存在");
		}
		
		//判断指定的ContentProvider是否存在
		Uri uri = Uri.parse("content://mobile.android.regincontentprovider/cities");
		Cursor cursor = getContentResolver().query(uri, new String[]{"city_code as _id", "city_name"}, 
				null, null, null);
		if (cursor == null) {
			Log.d("debug", "不存在");
		}

posted on 2013-05-14 16:00  纯洁的坏蛋  阅读(1615)  评论(0编辑  收藏  举报