小编vis*_*pta的帖子

如何停止横幅广告加载?

一些用户故意多次尝试点击横幅广告。因此我们面临帐户暂停或终止的问题。有谁知道如果广告超过某个限制(例如 3),如何停止加载。

    AdView adView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder()
            .setRequestAgent("android_studio:ad_template").build();

    adView.loadAd(adRequest);
    if(currentbannerclick>3)
    {

       // some code to not load the ad.
    }
Run Code Online (Sandbox Code Playgroud)

android ads admob

6
推荐指数
1
解决办法
1642
查看次数

如何在Android应用程序中打开Youtube视频链接?

我的问题与关于如何打开YouTube链接的其他问题类似.我的问题是如何打开YouTube链接,然后当它在应用程序中打开时,它应关闭YouTube应用程序并再次打电话给我MainActivity打开YouTube应用程序.但是,它应该通过scrath打开YouTube应用,而不仅仅是显示之前在后台运行的YouTube活动.

MainAcitivy - > SecondActivity - > Youtube - > ThirdActivity - > Youtube

但我希望从头开始重新加载YouTube应用.但目前,我正在获取之前打开的YouTube应用程序.

主要活动

Intent intent = new Intent(MainActivity.this,ThirdActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
Run Code Online (Sandbox Code Playgroud)

SecondActivity

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(link)));
sleep(10000);
Intent intent=new Intent(getApplicationContext(),ThirdActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
Run Code Online (Sandbox Code Playgroud)

ThirdActivity

sleep(5000);
Toast.makeText(getApplicationContext(),"third",Toast.LENGTH_SHORT).show();
Intent intent=new Intent(getApplicationContext(),SecondActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
Run Code Online (Sandbox Code Playgroud)

我想从头开始每次加载它,但是它显示了它暂停的状态.如果您不理解我的问题,请随意发表评论,我将尝试详细说明.提前致谢.

youtube android hyperlink android-intent

6
推荐指数
3
解决办法
1万
查看次数

如何处理背景和前景的firebase通知?

我想在后台和前台处理firebase通知消息.我将发送一条消息,其中包含来自开发人员的youtube链接,当用户点击通知栏时,它必须指示用户打开链接.有谁知道它是如何完成的?

 public void onMessageReceived(RemoteMessage remoteMessage) {
    // [START_EXCLUDE]
    // There are two types of messages data messages and notification messages. Data messages are handled
    // here in onMessageReceived whether the app is in the foreground or background. Data messages are the type
    // traditionally used with GCM. Notification messages are only received here in onMessageReceived when the app
    // is in the foreground. When the app is in the background an automatically generated notification is displayed.
    // When the user …
Run Code Online (Sandbox Code Playgroud)

android firebase firebase-cloud-messaging

6
推荐指数
1
解决办法
1万
查看次数

如何使用 Service Worker 或缓存对象通过 JavaScript 设置缓存过期时间

我可以使用删除方法删除缓存数据。但我想使用过期时间自动删除缓存数据。例如,它应该在 6 小时内被删除。

caches.delete(cacheName).then(function(boolean) {
  // your cache is now deleted
});
Run Code Online (Sandbox Code Playgroud)

javascript caching cache-control browser-cache service-worker

4
推荐指数
1
解决办法
8132
查看次数