private void InitFragment() { mConversationFragment = (ConversationFragment)SupportFragmentManager.FindFragmentByTag(LivepersonFragment); Log.Debug(Tag, "initFragment. mConversationFragment = " + mConversationFragment); try { if (mConversationFragment == null) { /* * * String authCode = SampleAppStorage.getInstance(FragmentContainerActivity.this).getAuthCode(); * String publicKey = SampleAppStorage.getInstance(FragmentContainerActivity.this).getPublicKey(); * * Log.d(TAG, "initFragment. authCode = "+ authCode); * Log.d(TAG, "initFragment. publicKey = "+ publicKey); * LPAuthenticationParams authParams = new LPAuthenticationParams(); * authParams.setAuthKey(authCode); * authParams.addCertificatePinningKey(publicKey); */ LPAuthenticationParams authParams = new LPAuthenticationParams(); CampaignInfo campaignInfo = null;//SampleAppUtils.getCampaignInfo(this); ConversationViewParams conversationViewParams = new ConversationViewParams().SetCampaignInfo(campaignInfo).SetReadOnlyMode(isReadOnly()); mConversationFragment = (ConversationFragment)LivePerson.GetConversationFragment(authParams, conversationViewParams); if (isValidState()) { // Pending intent for image foreground service Intent notificationIntent = new Intent(CallBackInFragmentcontext, typeof(Activity_Message)); //notificationIntent.SetFlags(Intent.Flags); PendingIntent pendingIntent = PendingIntent.GetActivity(CallBackInFragmentcontext, 0, notificationIntent, 0); LivePerson.SetImageServicePendingIntent(pendingIntent); // Notification builder for image upload foreground service Notification.Builder uploadBuilder = new Notification.Builder(CallBackInFragmentcontext); Notification.Builder downloadBuilder = new Notification.Builder(CallBackInFragmentcontext); uploadBuilder.SetContentTitle("Uploading image") //.SetSmallIcon(Android.R.drawable.arrow_up_float) .SetContentIntent(pendingIntent) .SetProgress(0, 0, true); downloadBuilder.SetContentTitle("Downloading image") //.setSmallIcon(Android.R.drawable.arrow_down_float) .SetContentIntent(pendingIntent) .SetProgress(0, 0, true); LivePerson.SetImageServiceUploadNotificationBuilder(uploadBuilder); LivePerson.SetImageServiceDownloadNotificationBuilder(downloadBuilder); var ft = SupportFragmentManager.BeginTransaction(); ft.Add(Resource.Id.frameLayout1, mConversationFragment, LivepersonFragment).CommitAllowingStateLoss(); } } else { AttachFragment(); } } catch (Java.Lang.Exception e) { throw e; } }
//private LivePersonCallbackImpl livePersonCallback; //private BroadcastReceiver mLivePersonReceiver; //private bool showToastOnCallback = true; //public static MainActivity Instance; protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // RegisterToLivePersonEvents(); MonitoringInitParams monitoringInitParams = new MonitoringInitParams(AppStorage.MAppinstallid); var initLivePerson = new InitLivePersonCallBackStartActivity(this); LivePerson.Initialize(ApplicationContext, new InitLivePersonProperties(AppStorage.BrandID, AppStorage.FCM_APP_ID, monitoringInitParams, new InitLivePersonCallBackStartActivity())); /* * LivePerson.initialize(getApplicationContext(), new InitLivePersonProperties(mAccountIdEditText.getText().toString(), SampleAppStorage.SDK_SAMPLE_FCM_APP_ID, monitoringInitParams, new InitLivePersonCallBack() { * * @Override * * public void onInitSucceed() * { * enableLogoutButton(true); * * Intent messagingIntent = new Intent(IntroActivity.this, MessagingActivity.class); * startActivity(messagingIntent); * } * * @Override * public void onInitFailed(Exception e) * { * Toast.makeText(IntroActivity.this, "Init failed", Toast.LENGTH_SHORT).show(); * } * })); * */ }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.MessageActivity); Log.Info(Tag, "onCreate savedInstanceState = " + savedInstanceState); var initLivePersonCallBackInFragment = new InitLivePersonCallBackInFragment(this, Tag, livepersonFragment, firstName, lastName, phone); LivePerson.Initialize(this, new InitLivePersonProperties(AppStorage.BrandID, AppStorage.FCM_APP_ID, new InitLivePersonCallBackInFragment())); }
public void OnInitSucceed() { Log.Info(Tag, "onInitSucceed"); var runnableHelper = new RunnableHelper(Tag, LivepersonFragment, CallBackInFragmentcontext); /* * RunOnUiThread(() => * //{ * // Run() * InitFragment() * // } * ); * */ RunOnUiThread(new RunnableHelper()); /* original Android implementaion * runOnUiThread(new Runnable() { * @Override * public void run() * { * initFragment(fragment_container_id); * } * }); */ SetCallBack(); ConsumerProfile consumerProfile = new ConsumerProfile.Builder() .SetFirstName(FirstName) .SetLastName(LastName) .SetPhoneNumber(Phone) .Build(); LivePerson.SetUserProfile(consumerProfile); //Constructing the notification builder for the upload/download foreground service and passing it to the SDK. /* * * Notification.Builder uploadBuilder = NotificationUI.createUploadNotificationBuilder(getApplicationContext()); * Notification.Builder downloadBuilder = NotificationUI.createDownloadNotificationBuilder(getApplicationContext()); * LivePerson.setImageServiceUploadNotificationBuilder(uploadBuilder); * LivePerson.setImageServiceDownloadNotificationBuilder(downloadBuilder); */ }
/// <summary> /// RegisterToLivePersonCallbacks /// </summary> public void RegisterToLivePersonCallbacks() { CreateLivePersonCallback(); LivePerson.SetCallback(livePersonCallback); }