title: Android studio permissions not working
body: <p>So I made a simple 0-100kmh calculator app nothing special, but my ads wont work I suppose thats because they need permissions and I just can't get them to work. Maybe I need to import class for it? Thank you for your time.</p>
  
  <pre><code>package com.example.lipa.kalkulator_0_100;
  
  import android.content.pm.PackageManager;
  import android.support.v4.app.ActivityCompat;
  import android.support.v4.content.ContextCompat;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.text.TextUtils;
  import android.view.View;
  import android.Manifest;
  import com.google.android.gms.ads.AdRequest;
  import com.google.android.gms.ads.AdView;
  import com.google.android.gms.ads.MobileAds;
  import android.widget.EditText;
  import android.widget.RadioButton;
  import android.widget.TextView;
  import android.widget.Toast;
  
  
  public class MainActivity extends AppCompatActivity implements View.OnClickListener {
  
  
  
  
      EditText Snaga;
      EditText Masa;
      RadioButton FWD;
      RadioButton RWD;
      RadioButton AWD;
      private AdView mAdView;
  
  
      TextView Rezultat;
  
  
      String oper ="";
  
      @Override
  
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
  
          MobileAds.initialize(getApplicationContext(), "ca-app-pub-5747237038129871~4158977342");
          mAdView = (AdView) findViewById(R.id.adView);
          AdRequest adRequest = new AdRequest.Builder().build();
          mAdView.loadAd(adRequest);
  
          if (ContextCompat.checkSelfPermission(this,
                  Manifest.permission.INTERNET)
                  != PackageManager.PERMISSION_GRANTED) {
  
              // Should we show an explanation?
              if (ActivityCompat.shouldShowRequestPermissionRationale(this,
                      Manifest.permission.INTERNET)) {
  
                  // Show an expanation to the user *asynchronously* -- don't block
                  // this thread waiting for the user's response! After the user
                  // sees the explanation, try again to request the permission.
  
              } else {
  
                  // No explanation needed, we can request the permission.
  
                  ActivityCompat.requestPermissions(this,
                          new String[]{Manifest.permission.INTERNET},
                          1);
  
                  // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
                  // app-defined int constant. The callback method gets the
                  // result of the request.
              }
          }
  
  
  
          if (getIntent().getBooleanExtra("EXIT", false))
          {
              finish();
          }
  
  
          //elementi
          FWD = (RadioButton) findViewById(R.id.fwd);
          RWD = (RadioButton)findViewById(R.id.rwd);
          AWD = (RadioButton)findViewById(R.id.awd);
          Masa = (EditText)findViewById(R.id.Masa);
          Snaga = (EditText)findViewById(R.id.Snaga);
          Rezultat = (TextView)findViewById(R.id.Rezultat);
  
  
      }
  
  
  
      public void onRadioClicked(View view) {
          double masa_unos;
          double snaga_unos;
          double result = 0;
          double rezpo;
          double rezkr = 0;
  
          if (TextUtils.isEmpty(Masa.getText().toString())
                  || TextUtils.isEmpty(Snaga.getText().toString())) {
              Toast.makeText(this, "Unesite vrijednosti!", Toast.LENGTH_SHORT).show();
              return;
          }
  
          masa_unos = Double.parseDouble(Masa.getText().toString());
          snaga_unos = Double.parseDouble(Snaga.getText().toString());
          boolean checked = ((RadioButton)view).isChecked();
          switch (view.getId()){
              case R.id.fwd:
                  oper= "Go";
                  if(checked)
                      result = (masa_unos+75) / snaga_unos;
                      rezkr = result;
                  break;
              case R.id.rwd:
                  oper= "Go";
                  if(checked)
                      result = (masa_unos+75) / snaga_unos;
                      rezpo = (result*0.076);
                      rezkr = result-rezpo;
                  break;
              case R.id.awd:
                  oper= "Go";
                  if(checked)
                      result = (masa_unos+75) / snaga_unos;
                      rezpo = (result*0.11478);
                      rezkr = result-rezpo;
  
                  break;
          }
              Rezultat.setText(String.format("%.2f sec", rezkr));
      }
  
  
  
      @Override
      public void onClick(View v) {
  
      }
  
      @Override
      public void onRequestPermissionsResult(int requestCode,
                                             String permissions[], int[] grantResults) {
          switch (requestCode) {
              case 1: {
                  // If request is cancelled, the result arrays are empty.
                  if (grantResults.length &gt; 0
                          &amp;&amp; grantResults[0] == PackageManager.PERMISSION_GRANTED) {
  
                      // permission was granted, yay! Do the
                      // contacts-related task you need to do.
  
                  } else {
  
                      // permission denied, boo! Disable the
                      // functionality that depends on this permission.
                  }
                  return;
              }
  
              // other 'case' lines to check for other
              // permissions this app might request
          }
      }
  
  
  
  }
  </code></pre>