title: Ads Admob Interstitial + Loading Page Activity After Open App | in Android Studio 4.2.2 Jelly Bean
body: <p><img src="https://i.stack.imgur.com/fMiru.jpg" alt="enter image description here"></p>
  
  <p><strong>How to add interstitial admob to my project (Version 4.2.2 Jelly Bean)?</strong>
  Admob appears when the app is run and when the app is closed.</p>
  
  <p>I want the interstitial admob logic like in the picture above or as recommended by google.
  If you know, please help me ...
  If you know, please help me ...</p>
  
  <p><strong>This is my project code : Home.java</strong></p>
  
  <pre><code>public class Pro extends Fragment {
  // TODO: Rename parameter arguments, choose names that match
  // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
  private static final String ARG_PARAM1 = "param1";
  private static final String ARG_PARAM2 = "param2";
  private static final int PICKFILE_REQUEST_CODE = 1;
  
  public ValueCallback&lt;Uri[]&gt; mFilePathCallback;
  
  // TODO: Rename and change types of parameters
  private String mParam1;
  private String mParam2;
  
  private OnFragmentInteractionListener mListener;
  
  public Pro() {
      // Required empty public constructor
  }
  
  /**
   * Use this factory method to create a new instance of
   * this fragment using the provided parameters.
   *
   * @param param1 Parameter 1.
   * @param param2 Parameter 2.
   * @return A new instance of fragment Home.
   */
  // TODO: Rename and change types and number of parameters
  public static Pro newInstance(String param1, String param2) {
      Pro fragment = new Pro();
      Bundle args = new Bundle();
      args.putString(ARG_PARAM1, param1);
      args.putString(ARG_PARAM2, param2);
      fragment.setArguments(args);
      return fragment;
  }
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      if (getArguments() != null) {
          mParam1 = getArguments().getString(ARG_PARAM1);
          mParam2 = getArguments().getString(ARG_PARAM2);
      }
  }
  
  
  
  // TODO: Rename method, update argument and hook method into UI event
  public void onButtonPressed(Uri uri) {
      if (mListener != null) {
          mListener.onFragmentInteraction(uri);
      }
  }
  
  @Override
  public void onAttach(Context context) {
      super.onAttach(context);
      if (context instanceof OnFragmentInteractionListener) {
          mListener = (OnFragmentInteractionListener) context;
      } else {
          throw new RuntimeException(context.toString()
                  + " must implement OnFragmentInteractionListener");
      }
  }
  
  @Override
  public void onDetach() {
      super.onDetach();
      mListener = null;
  }
  
  /**
   * This interface must be implemented by activities that contain this
   * fragment to allow an interaction in this fragment to be communicated
   * to the activity and potentially other fragments contained in that
   * activity.
   * &lt;p&gt;
   * See the Android Training lesson &lt;a href=
   * "http://developer.android.com/training/basics/fragments/communicating.html"
   * &gt;Communicating with Other Fragments&lt;/a&gt; for more information.
   */
  public interface OnFragmentInteractionListener {
      // TODO: Update argument type and name
      void onFragmentInteraction(Uri uri);
  }
  
  private View mContentView;
  
  private Handler handler = new Handler(){
      @Override
      public void handleMessage(Message message) {
          switch (message.what) {
              case 1:{
                  webViewGoBack();
              }break;
          }
      }
  };
  
  
  
  
  public static Pro newInstance() {
      Pro fragment = new Pro();
      return fragment;
  }
  
  private WebView webView;
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState){
      View v = inflater.inflate(R.layout.fragment_pro, parent, false);
  
      webView = (WebView) v.findViewById(R.id.webPage);
      webView.setWebChromeClient(new WebChromeClient());
  
      WebSettings webSettings = webView.getSettings();
      webSettings.setJavaScriptEnabled(true);
      Uri data = Uri.parse("http://192.168.1.104/safa/pro");
      webView.loadUrl(data.toString());
  
      webView.setOnKeyListener(new View.OnKeyListener(){
          public boolean onKey(View v, int keyCode, KeyEvent event) {
              if (keyCode == KeyEvent.KEYCODE_BACK
                      &amp;&amp; event.getAction() == MotionEvent.ACTION_UP
                      &amp;&amp; webView.canGoBack()) {
                  handler.sendEmptyMessage(1);
                  return true;
              }
  
              return false;
          }
  
      });
      webView.setWebChromeClient(new WebChromeClient() {
  
  
          @Override
          public boolean onShowFileChooser(WebView webView, ValueCallback&lt;Uri[]&gt; filePathCallback, FileChooserParams fileChooserParams) {
              mFilePathCallback = filePathCallback;
              Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
              intent.setType("*/*");
              startActivityForResult(intent, PICKFILE_REQUEST_CODE);
              return true;
          }
      });
  
      webView.setWebViewClient(new WebViewClient(){
          public boolean shouldOverrideUrlLoading(WebView view, String url) {
              if (url.startsWith("sms:") || url.startsWith("tel:") || url.startsWith("mailto:")
                      || url.startsWith("bbmi://") || url.startsWith("whatsapp://")
                      || url.startsWith("https://www.google.co.id/maps/") || url.startsWith("https://www.youtube.com")
                      || url.startsWith("https://www.facebook.com/") || url.startsWith("https://twitter.com/")
                      || url.startsWith("https://play.google.com/") || url.startsWith("https://mail.google.com/")
  
  
                      )  {
                  view.getContext().startActivity(
                          new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
                  return true;
              } else {
                  return false;
              }
          }
  
          public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
              webView.loadUrl("file:///android_asset/404.html");
  
          }
      });
      return v;
  }
  
  public boolean canGoBack() {
      return this.webView != null &amp;&amp; this.webView.canGoBack();
  }
  
  public void goBack() {
      if(this.webView != null) {
          this.webView.goBack();
      }
  }
  private void webViewGoBack(){
      webView.goBack();
  }
  
  
  
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent intent) {
      if (requestCode == PICKFILE_REQUEST_CODE) {
          //Uri result = intent.getData();
          Uri result = intent == null || resultCode != RESULT_OK ? null
                  : intent.getData();
          if(result != null){
              Uri[] resultsArray = new Uri[1];
              resultsArray[0] = result;
              mFilePathCallback.onReceiveValue(resultsArray);
          }
          else
              mFilePathCallback.onReceiveValue(null);
  
      }
  }
  </code></pre>
  
  <p>}</p>