示例#1
0
        internal virtual void createVerification(string phoneNumber, string method, bool skipPermissionCheck)
        {
            Config config = SinchVerification.config().applicationKey(APPLICATION_KEY).context(ApplicationContext).build();
            VerificationListener listener = new MyVerificationListener(this);

            if (method.Equals(MainActivity.SMS, StringComparison.CurrentCultureIgnoreCase))
            {
                if (!skipPermissionCheck && ContextCompat.checkSelfPermission(this, Manifest.permission.READ_SMS) == PackageManager.PERMISSION_DENIED)
                {
                    ActivityCompat.requestPermissions(this, new string[] { Manifest.permission.READ_SMS }, 0);
                    hideProgressBar();
                }
                else
                {
                    mVerification = SinchVerification.createSmsVerification(config, phoneNumber, listener);
                    mVerification.initiate();
                }
            }
            else
            {
                TextView messageText = (TextView)findViewById(R.id.textView);
                messageText.Text = [email protected];
                mVerification    = SinchVerification.createFlashCallVerification(config, phoneNumber, listener);
                mVerification.initiate();
            }
        }
示例#2
0
            public virtual StringBuilder sbMethod()
            {
                try
                {
                    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED)
                    {
                        ActivityCompat.requestPermissions(this, new string[] { Manifest.permission.ACCESS_FINE_LOCATION }, 101);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                }

                //need to fix so it pulls phone location and uses that lat and long instead of artificial data
                LocationManager lm        = (LocationManager)getSystemService((LOCATION_SERVICE));
                Location        location  = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
                double          longitude = location.getLongitude();
                double          latitude  = location.getLatitude();

                //creating list of locations to set apart as restaurant
                StringBuilder sb = new StringBuilder("https://maps.googleapis.com/maps/api/place/nearbysearch/json?");

                sb.Append("location=" + latitude + "," + longitude);
                sb.Append("&radius=5000");
                sb.Append("&types=" + "restaurant");
                sb.Append("&sensor=true");

                sb.Append("&key=AIzaSyCcTfucmrtRZd487Z3UTk6W2lcqO5HQM80");

                Log.d("Map", "url: " + sb.ToString());

                return(sb);
            }
示例#3
0
            public override void onMapReady(GoogleMap googleMap)
            {
                mMap = googleMap;

                try
                {
                    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED)
                    {
                        ActivityCompat.requestPermissions(this, new string[] { Manifest.permission.ACCESS_FINE_LOCATION }, 101);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                }



                mMap.setMyLocationEnabled(true);

                StringBuilder sbValue    = new StringBuilder(sbMethod());
                PlacesTask    placesTask = new PlacesTask(this);

                placesTask.execute(sbValue.ToString());
                //fix to use phone location and not artificial data
                LocationManager lm          = (LocationManager)getSystemService((LOCATION_SERVICE));
                Location        location    = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
                double          longitude   = location.getLongitude();
                double          latitude    = location.getLatitude();
                LatLng          current_loc = new LatLng(latitude, longitude);

                mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(current_loc, 18.0f));
                //mMap.moveCamera(CameraUpdateFactory.newLatLng(current_loc));
            }
        void request()
        {
            AndroidJavaClass  javaUnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            AndroidJavaObject currentActivity = javaUnityPlayer.GetStatic <AndroidJavaObject>("currentActivity");
            Activity          aaa             = HmsUtil.GetHmsBase <Activity>(currentActivity);

            ActivityCompat.requestPermissions(aaa, permissions, 1);
        }
示例#5
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);
     }
 }
示例#6
0
 private void requestPermissionForCameraAndMicrophone()
 {
     if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA) || ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.RECORD_AUDIO))
     {
         Toast.makeText(this, [email protected]_needed, Toast.LENGTH_LONG).show();
     }
     else
     {
         ActivityCompat.requestPermissions(this, new string[] { Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO }, CAMERA_MIC_PERMISSION_REQUEST_CODE);
     }
 }
示例#7
0
        private void ensurePermissions(params string[] permissions)
        {
            List <string> deniedPermissionList = new List <string>();

            foreach (string permission in permissions)
            {
                if (PackageManager.PERMISSION_GRANTED != ContextCompat.checkSelfPermission(this, permission))
                {
                    deniedPermissionList.Add(permission);
                }
            }

            if (deniedPermissionList.Count > 0)
            {
                ActivityCompat.requestPermissions(this, deniedPermissionList.ToArray(), 0);
            }
        }
示例#8
0
        private static void setPermission(string[] s, int arg)
        {
            Context ctx     = new Context();
            int     PMPG    = AndroidUtil.GetPMPermissionGranted();
            bool    needSet = false;

            for (int i = 0; i < s.Length; i++)
            {
                if (ActivityCompat.checkSelfPermission(ctx, s[i]) != PMPG)
                {
                    needSet = true;
                    break;
                }
            }
            if (needSet)
            {
                ActivityCompat.requestPermissions(ctx, s, arg);
            }
        }
        private void answerClicked()
        {
            mAudioPlayer.stopRingtone();
            Call call = SinchServiceInterface.getCall(mCallId);

            if (call != null)
            {
                try
                {
                    call.answer();
                    Intent intent = new Intent(this, typeof(CallScreenActivity));
                    intent.putExtra(SinchService.CALL_ID, mCallId);
                    startActivity(intent);
                }
                catch (MissingPermissionException e)
                {
                    ActivityCompat.requestPermissions(this, new string[] { e.RequiredPermission }, 0);
                }
            }
            else
            {
                finish();
            }
        }