當前位置: 首頁>>代碼示例>>Java>>正文


Java LinphoneCoreFactory類代碼示例

本文整理匯總了Java中org.linphone.core.LinphoneCoreFactory的典型用法代碼示例。如果您正苦於以下問題:Java LinphoneCoreFactory類的具體用法?Java LinphoneCoreFactory怎麽用?Java LinphoneCoreFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LinphoneCoreFactory類屬於org.linphone.core包,在下文中一共展示了LinphoneCoreFactory類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreateView

import org.linphone.core.LinphoneCoreFactory; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
						 Bundle savedInstanceState) {
	View view = inflater.inflate(R.layout.assistant_account_creation_email_activation, container, false);

	accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc()
			, LinphonePreferences.instance().getXmlrpcUrl());
	accountCreator.setDomain(getResources().getString(R.string.default_domain));
	accountCreator.setListener(this);

	username = getArguments().getString("Username");
	password = getArguments().getString("Password");

	accountCreator.setUsername(username);
	accountCreator.setPassword(password);

	email = (TextView) view.findViewById(R.id.send_email);
	email.setText(getArguments().getString("Email"));

	checkAccount = (Button) view.findViewById(R.id.assistant_check);
	checkAccount.setOnClickListener(this);
	return view;
}
 
開發者ID:treasure-lau,項目名稱:Linphone4Android,代碼行數:24,代碼來源:CreateAccountActivationFragment.java

示例2: onPostExecute

import org.linphone.core.LinphoneCoreFactory; //導入依賴的package包/類
@Override
protected void onPostExecute(byte[] result) {
	if (progressDialog != null && progressDialog.isShowing()) {
		progressDialog.dismiss();
	}
	mUploadingImageStream = new ByteArrayInputStream(result);

	String fileName = path.substring(path.lastIndexOf("/") + 1);
	String extension = LinphoneUtils.getExtensionFromFileName(fileName);
	LinphoneContent content = LinphoneCoreFactory.instance().createLinphoneContent("image", extension, result, null);
	content.setName(fileName);

	LinphoneChatMessage message = chatRoom.createFileTransferMessage(content);
	message.setListener(LinphoneManager.getInstance());
	message.setAppData(path);

	LinphoneManager.getInstance().setUploadPendingFileMessage(message);
	LinphoneManager.getInstance().setUploadingImageStream(mUploadingImageStream);

	chatRoom.sendChatMessage(message);
	adapter.addMessage(message);
}
 
開發者ID:treasure-lau,項目名稱:Linphone4Android,代碼行數:23,代碼來源:ChatFragment.java

示例3: configuringStatus

import org.linphone.core.LinphoneCoreFactory; //導入依賴的package包/類
@Override
public void configuringStatus(LinphoneCore lc,
		RemoteProvisioningState state, String message) {
	Log.d("Remote provisioning status = " + state.toString() + " (" + message + ")");

	if (state == RemoteProvisioningState.ConfiguringSuccessful) {
		if (LinphonePreferences.instance().isProvisioningLoginViewEnabled()) {
			LinphoneProxyConfig proxyConfig = lc.createProxyConfig();
			try {
				LinphoneAddress addr = LinphoneCoreFactory.instance().createLinphoneAddress(proxyConfig.getIdentity());
				wizardLoginViewDomain = addr.getDomain();
			} catch (LinphoneCoreException e) {
				wizardLoginViewDomain = null;
			}
		}
	}
}
 
開發者ID:treasure-lau,項目名稱:Linphone4Android,代碼行數:18,代碼來源:LinphoneManager.java

示例4: onClick

import org.linphone.core.LinphoneCoreFactory; //導入依賴的package包/類
@Override
public void onClick(View v) {
	int id = v.getId();

	if (id == R.id.back) {
		getFragmentManager().popBackStackImmediate();
	} if (id == R.id.call) {
		LinphoneActivity.instance().setAddresGoToDialerAndCall(sipUri, displayName, pictureUri == null ? null : Uri.parse(pictureUri));
	} else if (id == R.id.chat) {
		LinphoneActivity.instance().displayChat(sipUri);
	} else if (id == R.id.add_contact) {
		String uri = sipUri;
		try {
			LinphoneAddress addr = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
			uri = addr.asStringUriOnly();
		} catch (LinphoneCoreException e) {
			Log.e(e);
		}
		LinphoneActivity.instance().displayContactsForEdition(uri);
	} else if (id == R.id.goto_contact) {
		LinphoneActivity.instance().displayContact(contact, false);
	}
}
 
開發者ID:treasure-lau,項目名稱:Linphone4Android,代碼行數:24,代碼來源:HistoryDetailFragment.java

示例5: getAccountTransport

import org.linphone.core.LinphoneCoreFactory; //導入依賴的package包/類
public TransportType getAccountTransport(int n) {
	TransportType transport = null;
	LinphoneProxyConfig proxyConfig = getProxyConfig(n);

	if (proxyConfig != null) {
		LinphoneAddress proxyAddr;
		try {
			proxyAddr = LinphoneCoreFactory.instance().createLinphoneAddress(proxyConfig.getProxy());
			transport = proxyAddr.getTransport();
		} catch (LinphoneCoreException e) {
			Log.e(e);
		}
	}

	return transport;
}
 
開發者ID:treasure-lau,項目名稱:Linphone4Android,代碼行數:17,代碼來源:LinphonePreferences.java

示例6: setTurnUsername

import org.linphone.core.LinphoneCoreFactory; //導入依賴的package包/類
public void setTurnUsername(String username) {
	LinphoneNatPolicy nat = getOrCreateNatPolicy();
	LinphoneAuthInfo authInfo = getLc().findAuthInfo(nat.getStunServerUsername(), null, null);

	if (authInfo != null) {
		LinphoneAuthInfo cloneAuthInfo = authInfo.clone();
		getLc().removeAuthInfo(authInfo);
		cloneAuthInfo.setUsername(username);
		cloneAuthInfo.setUserId(username);
		getLc().addAuthInfo(cloneAuthInfo);
	} else {
		authInfo = LinphoneCoreFactory.instance().createAuthInfo(username, username, null, null, null, null);
		getLc().addAuthInfo(authInfo);
	}
	nat.setStunServerUsername(username);
	getLc().setNatPolicy(nat);
}
 
開發者ID:treasure-lau,項目名稱:Linphone4Android,代碼行數:18,代碼來源:LinphonePreferences.java

示例7: launchDownloadCodec

import org.linphone.core.LinphoneCoreFactory; //導入依賴的package包/類
private void launchDownloadCodec() {
	if (LinphoneManager.getLc().openH264Enabled()) {
		OpenH264DownloadHelper downloadHelper = LinphoneCoreFactory.instance().createOpenH264DownloadHelper();
		if (Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86") && !downloadHelper.isCodecFound()) {
			CodecDownloaderFragment codecFragment = new CodecDownloaderFragment();
			changeFragment(codecFragment);
			currentFragment = AssistantFragmentsEnum.DOWNLOAD_CODEC;
			back.setVisibility(View.VISIBLE);
			cancel.setEnabled(false);
		} else
			goToLinphoneActivity();
	} else {
		goToLinphoneActivity();
	}
}
 
開發者ID:treasure-lau,項目名稱:Linphone4Android,代碼行數:16,代碼來源:AssistantActivity.java

示例8: changeStatusToOnline

import org.linphone.core.LinphoneCoreFactory; //導入依賴的package包/類
public void changeStatusToOnline() {
	LinphoneCore lc = getLcIfManagerNotDestroyedOrNull();
	if (isInstanciated() && lc != null && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.Online) {
		lc.getPresenceModel().getActivity().setType(PresenceActivityType.Online);
	} else if (isInstanciated() && lc != null && !isPresenceModelActivitySet()) {
		PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.Online, null);
		lc.setPresenceModel(model);
	}
}
 
開發者ID:treasure-lau,項目名稱:Linphone4Android,代碼行數:10,代碼來源:LinphoneManager.java

示例9: changeStatusToOnThePhone

import org.linphone.core.LinphoneCoreFactory; //導入依賴的package包/類
public void changeStatusToOnThePhone() {
	LinphoneCore lc = getLcIfManagerNotDestroyedOrNull();
	if (isInstanciated() && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.OnThePhone) {
		lc.getPresenceModel().getActivity().setType(PresenceActivityType.OnThePhone);
	} else if (isInstanciated() && !isPresenceModelActivitySet()) {
		PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.OnThePhone, null);
		lc.setPresenceModel(model);
	}
}
 
開發者ID:treasure-lau,項目名稱:Linphone4Android,代碼行數:10,代碼來源:LinphoneManager.java

示例10: changeStatusToOffline

import org.linphone.core.LinphoneCoreFactory; //導入依賴的package包/類
public void changeStatusToOffline() {
	LinphoneCore lc = getLcIfManagerNotDestroyedOrNull();
	if (isInstanciated() && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.Offline) {
		lc.getPresenceModel().getActivity().setType(PresenceActivityType.Offline);
	} else if (isInstanciated() && !isPresenceModelActivitySet()) {
		PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.Offline, null);
		lc.setPresenceModel(model);
	}
}
 
開發者ID:treasure-lau,項目名稱:Linphone4Android,代碼行數:10,代碼來源:LinphoneManager.java

示例11: startLibLinphone

import org.linphone.core.LinphoneCoreFactory; //導入依賴的package包/類
private synchronized void startLibLinphone(Context c) {
	try {
		copyAssetsFromPackage();
		//traces alway start with traces enable to not missed first initialization

		mLc = LinphoneCoreFactory.instance().createLinphoneCore(this, mLinphoneConfigFile, mLinphoneFactoryConfigFile, null, c);

		TimerTask lTask = new TimerTask() {
			@Override
			public void run() {
				UIThreadDispatcher.dispatch(new Runnable() {
					@Override
					public void run() {
						if (mLc != null) {
							mLc.iterate();
						}
					}
				});
			}
		};
		/*use schedule instead of scheduleAtFixedRate to avoid iterate from being call in burst after cpu wake up*/
		mTimer = new Timer("Linphone scheduler");
		mTimer.schedule(lTask, 0, 20);
	}
	catch (Exception e) {
		Log.e(e);
		Log.e(e, "Cannot start linphone");
	}
}
 
開發者ID:treasure-lau,項目名稱:Linphone4Android,代碼行數:30,代碼來源:LinphoneManager.java

示例12: initLiblinphone

import org.linphone.core.LinphoneCoreFactory; //導入依賴的package包/類
private synchronized void initLiblinphone(LinphoneCore lc) throws LinphoneCoreException {
	mLc = lc;

	PreferencesMigrator prefMigrator = new PreferencesMigrator(mServiceContext);
	prefMigrator.migrateRemoteProvisioningUriIfNeeded();
	prefMigrator.migrateSharingServerUrlIfNeeded();
	prefMigrator.doPresenceMigrationIfNeeded();

	if (prefMigrator.isMigrationNeeded()) {
		prefMigrator.doMigration();
	}

	// Some devices could be using software AEC before
	// This will disable it in favor of hardware AEC if available
	if (prefMigrator.isEchoMigratioNeeded()) {
		Log.d("Echo canceller configuration need to be updated");
		prefMigrator.doEchoMigration();
		mPrefs.echoConfigurationUpdated();
	}

	mLc.setZrtpSecretsCache(basePath + "/zrtp_secrets");

	try {
		String versionName = mServiceContext.getPackageManager().getPackageInfo(mServiceContext.getPackageName(), 0).versionName;
		if (versionName == null) {
			versionName = String.valueOf(mServiceContext.getPackageManager().getPackageInfo(mServiceContext.getPackageName(), 0).versionCode);
		}
		mLc.setUserAgent("LinphoneAndroid", versionName);
	} catch (NameNotFoundException e) {
		Log.e(e, "cannot get version name");
	}

	mLc.setRingback(mRingbackSoundFile);
	mLc.setRootCA(mLinphoneRootCaFile);
	mLc.setPlayFile(mPauseSoundFile);
	mLc.setChatDatabasePath(mChatDatabaseFile);
	mLc.setCallLogsDatabasePath(mCallLogDatabaseFile);
	mLc.setFriendsDatabasePath(mFriendsDatabaseFile);
	mLc.setUserCertificatesPath(mUserCertificatePath);
	subscribeFriendList(mPrefs.isFriendlistsubscriptionEnabled());
	//mLc.setCallErrorTone(Reason.NotFound, mErrorToneFile);
	enableDeviceRingtone(mPrefs.isDeviceRingtoneEnabled());

	int availableCores = Runtime.getRuntime().availableProcessors();
	Log.w("MediaStreamer : " + availableCores + " cores detected and configured");
	mLc.setCpuCount(availableCores);

	mLc.migrateCallLogs();

	if (mServiceContext.getResources().getBoolean(R.bool.enable_push_id)) {
		initPushNotificationsService();
	}

	/*
	 You cannot receive this through components declared in manifests, only
	 by explicitly registering for it with Context.registerReceiver(). This is a protected intent that can only
	 be sent by the system.
	*/
	mKeepAliveIntentFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
	mKeepAliveIntentFilter.addAction(Intent.ACTION_SCREEN_OFF);
	mKeepAliveReceiver = new KeepAliveReceiver();
	mServiceContext.registerReceiver(mKeepAliveReceiver, mKeepAliveIntentFilter);

	updateNetworkReachability();

	resetCameraFromPreferences();

	accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(), LinphonePreferences.instance().getXmlrpcUrl());
	accountCreator.setDomain(getString(R.string.default_domain));
	accountCreator.setListener(this);
}
 
開發者ID:treasure-lau,項目名稱:Linphone4Android,代碼行數:72,代碼來源:LinphoneManager.java

示例13: onReceive

import org.linphone.core.LinphoneCoreFactory; //導入依賴的package包/類
@Override
public void onReceive(Context context, Intent intent) {
	if (!LinphoneService.isReady()) {
		return;
	} else {
		boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
		LinphoneCoreFactory.instance().enableLogCollection(isDebugEnabled);
		LinphoneCoreFactory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name));
		LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
		if (lc == null) return;
		
		String action = intent.getAction();
		if (action == null) {
			Log.i("[KeepAlive] Refresh registers");
			lc.refreshRegisters();
			//make sure iterate will have enough time, device will not sleep until exit from this method
			try {
				Thread.sleep(2000);
			} catch (InterruptedException e) {
				Log.e("Cannot sleep for 2s", e);
			} finally {
				//make sure the application will at least wakes up every 10 mn
				Intent newIntent = new Intent(context, KeepAliveReceiver.class);
				PendingIntent keepAlivePendingIntent = PendingIntent.getBroadcast(context, 0, newIntent, PendingIntent.FLAG_ONE_SHOT);

				AlarmManager alarmManager = ((AlarmManager) context.getSystemService(Context.ALARM_SERVICE));
				Compatibility.scheduleAlarm(alarmManager, AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 600000, keepAlivePendingIntent);
			}
		} else if (action.equalsIgnoreCase(Intent.ACTION_SCREEN_ON)) {
			Log.i("[KeepAlive] Screen is on, enable");
			lc.enableKeepAlive(true);
		} else if (action.equalsIgnoreCase(Intent.ACTION_SCREEN_OFF)) {
			Log.i("[KeepAlive] Screen is off, disable");
			lc.enableKeepAlive(false);
		}
	}
}
 
開發者ID:treasure-lau,項目名稱:Linphone4Android,代碼行數:38,代碼來源:KeepAliveReceiver.java

示例14: onClick

import org.linphone.core.LinphoneCoreFactory; //導入依賴的package包/類
@Override
public void onClick(View v) {
	String serverUrl = server.getText().toString();
	String serverDomain = serverUrl.replace("http://", "").replace("https://", "").split("/")[0]; // We just want the domain name
	LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo(username.getText().toString(), null, password.getText().toString(), ha1.getText().toString(), "SabreDAV", serverDomain);
	lc.addAuthInfo(authInfo);
	
	lfl.setUri(serverUrl);
	lfl.setListener(this);
	synchronize.setEnabled(false);
	lfl.synchronizeFriendsFromServer();
}
 
開發者ID:treasure-lau,項目名稱:Linphone4Android,代碼行數:13,代碼來源:TutorialCardDavSync.java

示例15: displayHistory

import org.linphone.core.LinphoneCoreFactory; //導入依賴的package包/類
private void displayHistory(String status, String callTime, String callDate) {
	if (status.equals(getResources().getString(R.string.missed))) {
		callDirection.setImageResource(R.drawable.call_missed);
	} else if (status.equals(getResources().getString(R.string.incoming))) {
		callDirection.setImageResource(R.drawable.call_incoming);
	} else if (status.equals(getResources().getString(R.string.outgoing))) {
		callDirection.setImageResource(R.drawable.call_outgoing);
	}
	
	time.setText(callTime == null ? "" : callTime);
	Long longDate = Long.parseLong(callDate);
	date.setText(LinphoneUtils.timestampToHumanDate(getActivity(),longDate,getString(R.string.history_detail_date_format)));

	LinphoneAddress lAddress = null;
	try {
		lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
	} catch (LinphoneCoreException e) {
		Log.e(e);
	}

	if (lAddress != null) {
		contactAddress.setText(lAddress.asStringUriOnly());
		contact = ContactsManager.getInstance().findContactFromAddress(lAddress);
		if (contact != null) {
			contactName.setText(contact.getFullName());
			LinphoneUtils.setImagePictureFromUri(view.getContext(),contactPicture,contact.getPhotoUri(),contact.getThumbnailUri());
			addToContacts.setVisibility(View.GONE);
			goToContact.setVisibility(View.VISIBLE);
		} else {
			contactName.setText(displayName == null ? LinphoneUtils.getAddressDisplayName(sipUri) : displayName);
			contactPicture.setImageResource(R.drawable.avatar);
			addToContacts.setVisibility(View.VISIBLE);
			goToContact.setVisibility(View.GONE);
		}
	} else {
		contactAddress.setText(sipUri);
		contactName.setText(displayName == null ? LinphoneUtils.getAddressDisplayName(sipUri) : displayName);
	}
}
 
開發者ID:treasure-lau,項目名稱:Linphone4Android,代碼行數:40,代碼來源:HistoryDetailFragment.java


注:本文中的org.linphone.core.LinphoneCoreFactory類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。