khirulnizam

Simple PHONE_CALL Manifest

Apr 10th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. public void onClick(View v){
  2. //capture number
  3. String tel=phone.getText().toString();
  4. //make call
  5. Intent cIntent=new Intent(Intent.ACTION_CALL);
  6. cIntent.setData(Uri.parse("tel:"+tel));
  7. if(ActivityCompat.checkSelfPermission(
  8. MainActivity.this,
  9. Manifest.permission.CALL_PHONE )!= PackageManager.PERMISSION_GRANTED)
  10. {
  11. return;
  12. }
  13. startActivity(cIntent);
  14. }//end onClick
  15.  
  16. //AndroidManifest
  17. //<uses-permission android:name="android.permission.CALL_PHONE" />
Advertisement
Add Comment
Please, Sign In to add comment