Flutter - Keyboard won't show up after tapping on ad





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















Keyboard won't show up after tapping on ad and returning back to the app but works fine before that.
also, if the app has multiple screens it with multiple text fields they wont work either.
the only way to make the keyboard show up again when pressing a text field is to force close the app and launch again.
i tried everything and could not find a way to fix it.
is there anyway to fix it or any workaround ?



thank you for reading



here is an example :



import 'package:firebase_admob/firebase_admob.dart';
import 'package:flutter/material.dart';

void main() {
runApp(MyApp());
}

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}

class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);

final String title;

@override
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
myBanner
..load()
..show(
anchorType: AnchorType.bottom,
);
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Card(
child: TextField(),
margin: EdgeInsets.all(50),
),
),
);
}
}

MobileAdTargetingInfo targetingInfo = MobileAdTargetingInfo(
keywords: <String>['flutterio', 'beautiful apps'],
contentUrl: 'https://flutter.io',
childDirected: false,
);

BannerAd myBanner = BannerAd(
adUnitId: BannerAd.testAdUnitId,
size: AdSize.smartBanner,
targetingInfo: targetingInfo,
listener: (MobileAdEvent event) {
print("BannerAd event is $event");
},
);


don't forget to add firebase_admob to your pubspec.yaml.



firebase_admob: ^0.7.0


Edit : also in the AndroidManifest.xml add those lines



 <meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~6300978111"/>


it should look like this





<!-- The INTERNET permission is required for development. Specifically,
flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>

<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="ad_bug"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~6300978111"/>
</application> </manifest>


Edit 2 : gitlab repo : https://gitlab.com/gitmaher/flutter_ad



Created Flutter issue https://github.com/flutter/flutter/issues/26064










share|improve this question































    0















    Keyboard won't show up after tapping on ad and returning back to the app but works fine before that.
    also, if the app has multiple screens it with multiple text fields they wont work either.
    the only way to make the keyboard show up again when pressing a text field is to force close the app and launch again.
    i tried everything and could not find a way to fix it.
    is there anyway to fix it or any workaround ?



    thank you for reading



    here is an example :



    import 'package:firebase_admob/firebase_admob.dart';
    import 'package:flutter/material.dart';

    void main() {
    runApp(MyApp());
    }

    class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
    return MaterialApp(
    title: 'Flutter Demo',
    theme: ThemeData(
    primarySwatch: Colors.blue,
    ),
    home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
    }
    }

    class MyHomePage extends StatefulWidget {
    MyHomePage({Key key, this.title}) : super(key: key);

    final String title;

    @override
    _MyHomePageState createState() => _MyHomePageState();
    }

    class _MyHomePageState extends State<MyHomePage> {
    @override
    Widget build(BuildContext context) {
    myBanner
    ..load()
    ..show(
    anchorType: AnchorType.bottom,
    );
    return Scaffold(
    appBar: AppBar(
    title: Text(widget.title),
    ),
    body: Center(
    child: Card(
    child: TextField(),
    margin: EdgeInsets.all(50),
    ),
    ),
    );
    }
    }

    MobileAdTargetingInfo targetingInfo = MobileAdTargetingInfo(
    keywords: <String>['flutterio', 'beautiful apps'],
    contentUrl: 'https://flutter.io',
    childDirected: false,
    );

    BannerAd myBanner = BannerAd(
    adUnitId: BannerAd.testAdUnitId,
    size: AdSize.smartBanner,
    targetingInfo: targetingInfo,
    listener: (MobileAdEvent event) {
    print("BannerAd event is $event");
    },
    );


    don't forget to add firebase_admob to your pubspec.yaml.



    firebase_admob: ^0.7.0


    Edit : also in the AndroidManifest.xml add those lines



     <meta-data
    android:name="com.google.android.gms.ads.APPLICATION_ID"
    android:value="ca-app-pub-3940256099942544~6300978111"/>


    it should look like this





    <!-- The INTERNET permission is required for development. Specifically,
    flutter needs it to communicate with the running application
    to allow setting breakpoints, to provide hot reload, etc.
    -->
    <uses-permission android:name="android.permission.INTERNET"/>

    <!-- io.flutter.app.FlutterApplication is an android.app.Application that
    calls FlutterMain.startInitialization(this); in its onCreate method.
    In most cases you can leave this as-is, but you if you want to provide
    additional functionality it is fine to subclass or reimplement
    FlutterApplication and put your custom class here. -->
    <application
    android:name="io.flutter.app.FlutterApplication"
    android:label="ad_bug"
    android:icon="@mipmap/ic_launcher">
    <activity
    android:name=".MainActivity"
    android:launchMode="singleTop"
    android:theme="@style/LaunchTheme"
    android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
    android:hardwareAccelerated="true"
    android:windowSoftInputMode="adjustResize">
    <!-- This keeps the window background of the activity showing
    until Flutter renders its first frame. It can be removed if
    there is no splash screen (such as the default splash screen
    defined in @style/LaunchTheme). -->
    <meta-data
    android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
    android:value="true" />
    <intent-filter>
    <action android:name="android.intent.action.MAIN"/>
    <category android:name="android.intent.category.LAUNCHER"/>
    </intent-filter>
    </activity>
    <meta-data
    android:name="com.google.android.gms.ads.APPLICATION_ID"
    android:value="ca-app-pub-3940256099942544~6300978111"/>
    </application> </manifest>


    Edit 2 : gitlab repo : https://gitlab.com/gitmaher/flutter_ad



    Created Flutter issue https://github.com/flutter/flutter/issues/26064










    share|improve this question



























      0












      0








      0








      Keyboard won't show up after tapping on ad and returning back to the app but works fine before that.
      also, if the app has multiple screens it with multiple text fields they wont work either.
      the only way to make the keyboard show up again when pressing a text field is to force close the app and launch again.
      i tried everything and could not find a way to fix it.
      is there anyway to fix it or any workaround ?



      thank you for reading



      here is an example :



      import 'package:firebase_admob/firebase_admob.dart';
      import 'package:flutter/material.dart';

      void main() {
      runApp(MyApp());
      }

      class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
      return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
      primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
      );
      }
      }

      class MyHomePage extends StatefulWidget {
      MyHomePage({Key key, this.title}) : super(key: key);

      final String title;

      @override
      _MyHomePageState createState() => _MyHomePageState();
      }

      class _MyHomePageState extends State<MyHomePage> {
      @override
      Widget build(BuildContext context) {
      myBanner
      ..load()
      ..show(
      anchorType: AnchorType.bottom,
      );
      return Scaffold(
      appBar: AppBar(
      title: Text(widget.title),
      ),
      body: Center(
      child: Card(
      child: TextField(),
      margin: EdgeInsets.all(50),
      ),
      ),
      );
      }
      }

      MobileAdTargetingInfo targetingInfo = MobileAdTargetingInfo(
      keywords: <String>['flutterio', 'beautiful apps'],
      contentUrl: 'https://flutter.io',
      childDirected: false,
      );

      BannerAd myBanner = BannerAd(
      adUnitId: BannerAd.testAdUnitId,
      size: AdSize.smartBanner,
      targetingInfo: targetingInfo,
      listener: (MobileAdEvent event) {
      print("BannerAd event is $event");
      },
      );


      don't forget to add firebase_admob to your pubspec.yaml.



      firebase_admob: ^0.7.0


      Edit : also in the AndroidManifest.xml add those lines



       <meta-data
      android:name="com.google.android.gms.ads.APPLICATION_ID"
      android:value="ca-app-pub-3940256099942544~6300978111"/>


      it should look like this





      <!-- The INTERNET permission is required for development. Specifically,
      flutter needs it to communicate with the running application
      to allow setting breakpoints, to provide hot reload, etc.
      -->
      <uses-permission android:name="android.permission.INTERNET"/>

      <!-- io.flutter.app.FlutterApplication is an android.app.Application that
      calls FlutterMain.startInitialization(this); in its onCreate method.
      In most cases you can leave this as-is, but you if you want to provide
      additional functionality it is fine to subclass or reimplement
      FlutterApplication and put your custom class here. -->
      <application
      android:name="io.flutter.app.FlutterApplication"
      android:label="ad_bug"
      android:icon="@mipmap/ic_launcher">
      <activity
      android:name=".MainActivity"
      android:launchMode="singleTop"
      android:theme="@style/LaunchTheme"
      android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
      android:hardwareAccelerated="true"
      android:windowSoftInputMode="adjustResize">
      <!-- This keeps the window background of the activity showing
      until Flutter renders its first frame. It can be removed if
      there is no splash screen (such as the default splash screen
      defined in @style/LaunchTheme). -->
      <meta-data
      android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
      android:value="true" />
      <intent-filter>
      <action android:name="android.intent.action.MAIN"/>
      <category android:name="android.intent.category.LAUNCHER"/>
      </intent-filter>
      </activity>
      <meta-data
      android:name="com.google.android.gms.ads.APPLICATION_ID"
      android:value="ca-app-pub-3940256099942544~6300978111"/>
      </application> </manifest>


      Edit 2 : gitlab repo : https://gitlab.com/gitmaher/flutter_ad



      Created Flutter issue https://github.com/flutter/flutter/issues/26064










      share|improve this question
















      Keyboard won't show up after tapping on ad and returning back to the app but works fine before that.
      also, if the app has multiple screens it with multiple text fields they wont work either.
      the only way to make the keyboard show up again when pressing a text field is to force close the app and launch again.
      i tried everything and could not find a way to fix it.
      is there anyway to fix it or any workaround ?



      thank you for reading



      here is an example :



      import 'package:firebase_admob/firebase_admob.dart';
      import 'package:flutter/material.dart';

      void main() {
      runApp(MyApp());
      }

      class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
      return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
      primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
      );
      }
      }

      class MyHomePage extends StatefulWidget {
      MyHomePage({Key key, this.title}) : super(key: key);

      final String title;

      @override
      _MyHomePageState createState() => _MyHomePageState();
      }

      class _MyHomePageState extends State<MyHomePage> {
      @override
      Widget build(BuildContext context) {
      myBanner
      ..load()
      ..show(
      anchorType: AnchorType.bottom,
      );
      return Scaffold(
      appBar: AppBar(
      title: Text(widget.title),
      ),
      body: Center(
      child: Card(
      child: TextField(),
      margin: EdgeInsets.all(50),
      ),
      ),
      );
      }
      }

      MobileAdTargetingInfo targetingInfo = MobileAdTargetingInfo(
      keywords: <String>['flutterio', 'beautiful apps'],
      contentUrl: 'https://flutter.io',
      childDirected: false,
      );

      BannerAd myBanner = BannerAd(
      adUnitId: BannerAd.testAdUnitId,
      size: AdSize.smartBanner,
      targetingInfo: targetingInfo,
      listener: (MobileAdEvent event) {
      print("BannerAd event is $event");
      },
      );


      don't forget to add firebase_admob to your pubspec.yaml.



      firebase_admob: ^0.7.0


      Edit : also in the AndroidManifest.xml add those lines



       <meta-data
      android:name="com.google.android.gms.ads.APPLICATION_ID"
      android:value="ca-app-pub-3940256099942544~6300978111"/>


      it should look like this





      <!-- The INTERNET permission is required for development. Specifically,
      flutter needs it to communicate with the running application
      to allow setting breakpoints, to provide hot reload, etc.
      -->
      <uses-permission android:name="android.permission.INTERNET"/>

      <!-- io.flutter.app.FlutterApplication is an android.app.Application that
      calls FlutterMain.startInitialization(this); in its onCreate method.
      In most cases you can leave this as-is, but you if you want to provide
      additional functionality it is fine to subclass or reimplement
      FlutterApplication and put your custom class here. -->
      <application
      android:name="io.flutter.app.FlutterApplication"
      android:label="ad_bug"
      android:icon="@mipmap/ic_launcher">
      <activity
      android:name=".MainActivity"
      android:launchMode="singleTop"
      android:theme="@style/LaunchTheme"
      android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
      android:hardwareAccelerated="true"
      android:windowSoftInputMode="adjustResize">
      <!-- This keeps the window background of the activity showing
      until Flutter renders its first frame. It can be removed if
      there is no splash screen (such as the default splash screen
      defined in @style/LaunchTheme). -->
      <meta-data
      android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
      android:value="true" />
      <intent-filter>
      <action android:name="android.intent.action.MAIN"/>
      <category android:name="android.intent.category.LAUNCHER"/>
      </intent-filter>
      </activity>
      <meta-data
      android:name="com.google.android.gms.ads.APPLICATION_ID"
      android:value="ca-app-pub-3940256099942544~6300978111"/>
      </application> </manifest>


      Edit 2 : gitlab repo : https://gitlab.com/gitmaher/flutter_ad



      Created Flutter issue https://github.com/flutter/flutter/issues/26064







      android dart flutter






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 4 at 9:17









      Günter Zöchbauer

      337k721037957




      337k721037957










      asked Jan 3 at 14:21









      ViralCodeViralCode

      245




      245
























          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54024176%2fflutter-keyboard-wont-show-up-after-tapping-on-ad%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54024176%2fflutter-keyboard-wont-show-up-after-tapping-on-ad%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          MongoDB - Not Authorized To Execute Command

          How to fix TextFormField cause rebuild widget in Flutter

          in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith