Looking for a $3.56 or less? app.
- Apps & Games
- 10 Replies
I tried that. Not what I wanted. Cool but not for me.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Thanx for the update.On Phone, go to settings -> system -> about -> Software Info -> build Number (this may be different for other phones)
Tap 8 times on Build Number
That will turn on Developer Option
Then Android Studio will recognize the Phone.
David
package com.example.testapp
import com.google.android.gms.ads.AdListener
import com.google.android.gms.ads.AdRequest
import com.google.android.gms.ads.interstitial.InterstitialAd
import android.widget.Button
import android.widget.TextView
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import android.view.Menu
import android.view.MenuItem
import android.widget.Toast
// Remove the line below after defining your own ad unit ID.
private const val TOAST_TEXT = "Test ads are being shown. " +
"To show live ads, replace the ad unit ID in res/values/strings.xml " +
"with your own ad unit ID."
private const val START_LEVEL = 1
class ad1PostButtonPush : AppCompatActivity() {
private var currentLevel: Int = 0
private var interstitialAd: InterstitialAd? = null
private lateinit var nextLevelButton: Button
private lateinit var levelTextView: TextView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_ad1_post_button_push)
// Create the next level button, which tries to show an interstitial when clicked.
nextLevelButton = findViewById(R.id.next_level_button)
nextLevelButton.isEnabled = false
nextLevelButton.setOnClickListener { showInterstitial() }
levelTextView = findViewById(R.id.level)
// Create the text view to show the level number.
currentLevel = START_LEVEL
// Create the InterstitialAd and set the adUnitId (defined in values/strings.xml).
interstitialAd = newInterstitialAd()
loadInterstitial()
// Toasts the test ad message on the screen. Remove this after defining your own ad unit ID.
Toast.makeText(this, TOAST_TEXT, Toast.LENGTH_LONG).show()
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
// Inflate the menu; this adds items to the action bar if it is present.
menuInflater.inflate(R.menu.menu_ad1_post_button_push, menu)
return true
}
override fun onOptionsItemSelected(item: MenuItem) =
when (item.itemId) {
R.id.action_settings -> true
else -> super.onOptionsItemSelected(item)
}
private fun newInterstitialAd(): InterstitialAd {
return InterstitialAd().apply {
adUnitId = getString(R.string.interstitial_ad_unit_id)
adListener = object : AdListener() {
override fun onAdLoaded() {
nextLevelButton.isEnabled = true
}
override fun onAdFailedToLoad(errorCode: Int) {
nextLevelButton.isEnabled = true
}
override fun onAdClosed() {
// Proceed to the next level.
goToNextLevel()
}
}
}
}
private fun showInterstitial() {
// Show the ad if it"s ready. Otherwise toast and reload the ad.
if (interstitialAd?.isLoaded == true) {
interstitialAd?.show()
} else {
Toast.makeText(this, "Ad did not load", Toast.LENGTH_SHORT).show()
goToNextLevel()
}
}
private fun loadInterstitial() {
// Disable the next level button and load the ad.
nextLevelButton.isEnabled = false
val adRequest = AdRequest.Builder()
.setRequestAgent("android_studio:ad_template")
.build()
interstitialAd?.loadAd(adRequest)
}
private fun goToNextLevel() {
// Show the next level and reload the ad to prepare for the level after.
levelTextView.text = "Level " + (++currentLevel)
interstitialAd = newInterstitialAd()
loadInterstitial()
}
}
...testapp\ad1PostButtonPush.kt: (62, 16): Cannot create an instance of an abstract class
...testapp\ad1PostButtonPush.kt: (63, 13): Val cannot be reassigned
...testapp\ad1PostButtonPush.kt: (64, 13): Unresolved reference: adListener
...testapp\ad1PostButtonPush.kt: (69, 17): 'onAdFailedToLoad' overrides nothing
...testapp\ad1PostButtonPush.kt: (83, 29): Unresolved reference: isLoaded
...testapp\ad1PostButtonPush.kt: (84, 34): No value passed for parameter 'p0'
...testapp\ad1PostButtonPush.kt: (97, 25): Unresolved reference: loadAd

Already did that. Reread my post. But thanks.Go into the settings, display, advanced, and set for how many minutes to keep the screen on.
Now I use Samsung Galaxy Note 10My love of classical started with Merrie Melodies cartoons. I'm not obsessed with who composed it or recorded it. It's like the original easy listening.
Which device you using @Steve_Fox?
yesdoes a new google drive backup on your phone get rid of a previous backup?