示例#1
0
            public override void onReceive(Context context, Intent intent)
            {
                string action = intent.Action;

                if (action.Equals(ACTION_SET_GCM_TOKEN))
                {
                    string gcmToken = intent.getStringExtra(KEY_GCM_TOKEN);
                    Log.i(TAG, "GCM Token : " + gcmToken);
                    outerInstance.gcmToken = gcmToken;
                    if (gcmToken == null)
                    {
                        Snackbar.make(outerInstance.coordinatorLayout, "Failed to get GCM Token. Unable to receive calls", Snackbar.LENGTH_LONG).show();
                    }
                    outerInstance.retrieveAccessToken();
                }
                else if (action.Equals(ACTION_INCOMING_CALL))
                {
                    /*
                     * Remove the notification from the notification drawer
                     */
                    outerInstance.notificationManager.cancel(intent.getIntExtra(VoiceActivity.INCOMING_CALL_NOTIFICATION_ID, 0));

                    /*
                     * Handle the incoming call message
                     */
                    VoiceClient.handleIncomingCallMessage(ApplicationContext, (IncomingCallMessage)intent.getParcelableExtra(INCOMING_CALL_MESSAGE), outerInstance.incomingCallMessageListener_Renamed);
                }
            }
示例#2
0
        /*
         * Called when participant joins the room
         */
        private void addParticipant(Participant participant)
        {
            /*
             * This app only displays video for one additional participant per Room
             */
            if (thumbnailVideoView.Visibility == View.VISIBLE)
            {
                Snackbar.make(connectActionFab, "Multiple participants are not currently support in this UI", Snackbar.LENGTH_LONG).setAction("Action", null).show();
                return;
            }
            participantIdentity      = participant.Identity;
            videoStatusTextView.Text = "Participant " + participantIdentity + " joined";

            /*
             * Stop rendering local video track in primary view and move it to thumbnail view
             */
            localVideoTrack.removeRenderer(primaryVideoView);
            thumbnailVideoView.Visibility = View.VISIBLE;
            localVideoTrack.addRenderer(thumbnailVideoView);
            localVideoView = thumbnailVideoView;

            /*
             * Start listening for participant media events
             */
            participant.Media.Listener = mediaListener();
        }
示例#3
0
 private void requestPermissionForMicrophone()
 {
     if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.RECORD_AUDIO))
     {
         Snackbar.make(coordinatorLayout, "Microphone permissions needed. Please allow in your application settings.", Snackbar.LENGTH_LONG).show();
     }
     else
     {
         ActivityCompat.requestPermissions(this, new string[] { Manifest.permission.RECORD_AUDIO }, MIC_PERMISSION_REQUEST_CODE);
     }
 }
示例#4
0
 public override void onCompleted(Exception e, string accessToken)
 {
     if (e == null)
     {
         Log.d(TAG, "Access token: " + accessToken);
         outerInstance.accessToken = accessToken;
         outerInstance.callActionFab.show();
         if (outerInstance.gcmToken != null)
         {
             outerInstance.register();
         }
     }
     else
     {
         Snackbar.make(outerInstance.coordinatorLayout, "Error retrieving access token. Unable to make calls", Snackbar.LENGTH_LONG).show();
     }
 }
示例#5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults)
        public override void onRequestPermissionsResult(int requestCode, string[] permissions, int[] grantResults)
        {
            /*
             * Check if microphone permissions is granted
             */
            if (requestCode == MIC_PERMISSION_REQUEST_CODE && permissions.Length > 0)
            {
                bool granted = true;
                if (granted)
                {
                    startGCMRegistration();
                }
                else
                {
                    Snackbar.make(coordinatorLayout, "Microphone permissions needed. Please allow in your application settings.", Snackbar.LENGTH_LONG).show();
                }
            }
        }