Skip to content

Instantly share code, notes, and snippets.

Luiz Marcus luizmarcus

View GitHub Profile
View exemplo_inlinekeyboard_callbackData_file.php
<?php
define('BOT_TOKEN', '000000000:0000000000000000000000000000');
define('API_URL', 'https://api.telegram.org/bot'.BOT_TOKEN.'/');
function processMessage($message) {
// processa a mensagem recebida
$message_id = $message['message_id'];
$chat_id = $message['chat']['id'];
if (isset($message['text'])) {
View exemplo_inlinekeyboard_callbackData.php
<?php
'reply_markup' => array('inline_keyboard' => array(
//linha 1
array(
array('text'=>'Mega-Sena','url'=>'http://g1.globo.com/loterias/megasena.html'), //botão 1
array('text'=>'Quina','url'=>'http://g1.globo.com/loterias/quina.html')//botão 2
),
//linha 2
array(
View exemplo_admob_flutter_main_widget.dart
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
View exemplo_admob_flutter_handleevent.dart
void handleEvent(
AdmobAdEvent event, Map<String, dynamic> args, String adType) {
switch (event) {
case AdmobAdEvent.loaded:
print('Novo $adType Ad carregado!');
break;
case AdmobAdEvent.opened:
print('Admob $adType Ad aberto!');
break;
case AdmobAdEvent.closed:
View exemplo_admob_flutter_setstate.dart
AdmobInterstitial interstitialAd;
@override
void initState() {
super.initState();
interstitialAd = AdmobInterstitial(
adUnitId: getInterstitialId(),
listener: (AdmobAdEvent event, Map<String, dynamic> args) {
if (event == AdmobAdEvent.closed) interstitialAd.load();
View exemplo_admob_flutter_ids.dart
final bannerAdIdAndroid = "ca-app-pub-3940256099942544/6300978111";
final bannerAdIdIos = "ca-app-pub-3940256099942544/2934735716";
final intertstitialAdIdAndroid = "ca-app-pub-3940256099942544/1033173712";
final intertstitialAdIdIos = "ca-app-pub-3940256099942544/4411468910";
String getBannerId() => Platform.isIOS ? bannerAdIdIos : bannerAdIdAndroid;
String getInterstitialId() => Platform.isIOS ? intertstitialAdIdIos : intertstitialAdIdAndroid;
View exemplo_admob_flutter_info.plist
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string>
<key>io.flutter.embedded_views_preview</key>
<true/>
View exemplo_admob_flutter_androidmainfest.xml
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~3347511713"/>
View exemplo_admob_flutter_main.dart
void main() {
Admob.initialize(getAppId());
runApp(MyApp());
}
String getAppId() => Platform.isIOS
? 'ca-app-pub-3940256099942544~1458002511'
: 'ca-app-pub-3940256099942544~3347511713';
You can’t perform that action at this time.