daily pastebin goal
76%
SHARE
TWEET

Untitled

a guest Apr 17th, 2018 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import com.google.android.gms.ads.AdRequest;
  2.     import com.google.android.gms.ads.AdView;
  3.  
  4.        @Override
  5.     protected void onCreate(Bundle savedInstanceState) {
  6.     super.onCreate(savedInstanceState);
  7.     setContentView(R.layout.activity_main);
  8.  
  9.     // Sample AdMob app ID: ca-app-pub-5289059028582551~3029249239
  10.     MobileAds.initialize(this, "ca-app-pub-5289059028582551~3029249239");
  11.     AdView adView = (AdView)findViewById(R.id.adView);
  12.     AdRequest adRequest = new AdRequest.Builder().build();
  13.     adView.loadAd(adRequest);
  14.  
  15.     editMessage = findViewById(R.id.editMessageE);
  16.     mDatabase = FirebaseDatabase.getInstance().getReference().child("Messages");
  17.     mMessageList = findViewById(R.id.messageRec);
  18.     mMessageList.setHasFixedSize(true);
  19.     LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
  20.     linearLayoutManager.setStackFromEnd(true);
  21.     mMessageList.setLayoutManager(linearLayoutManager);
  22.     mAuth = FirebaseAuth.getInstance();
  23.  
  24.     mAuthListener = new FirebaseAuth.AuthStateListener() {
  25.         @Override
  26.         public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
  27.             if (firebaseAuth.getCurrentUser() == null){
  28.                 startActivity(new Intent(MainActivity.this,RegisterActivity.class));
  29.             }
  30.         }
  31.     };
  32. }
  33.    
  34. <meta-data
  35.         android:name="com.google.android.gms.version"
  36.         android:value="@integer/google_play_services_version" />
  37.         <activity android:name="com.google.android.gms.ads.AdActivity"
  38.             android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
  39.             android:theme="@android:style/Theme.Translucent" />
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top