Skip to content

Instantly share code, notes, and snippets.

Avatar

Luiz Marcus luizmarcus

View GitHub Profile
View exemplo_webappbot_lib.html
<script src="https://telegram.org/js/telegram-web-app.js"></script>
View exemplo_webappbot_bot.php
<?php
define('BOT_TOKEN', 'SEU TOKEN');
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_webappbot_index.html
<!DOCTYPE html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<script src="https://telegram.org/js/telegram-web-app.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
function getProducts(){
$.ajax({
type:'GET',
View exemplo_webappbot_server.php
<?php
define('URL_API','https://api.unsplash.com/search/photos/?client_id=[CLIENT_ID]&query=computer&orientation=landscape&per_page=8');
$response = file_get_contents(URL_API);
$json = json_decode($response, true);
$images = array();
foreach($json['results'] as $image){
View exemplo_googleads_layout.dart
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text(
Constants.APP_NAME,
),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
View exemplo_googleads_intersticial.dart
InterstitialAd? _interstitialAd;
void _createInterstitialAd() {
InterstitialAd.load(
adUnitId: Constants.ADMOB_TEST_INTERSTITIAL_ID,
request: const AdRequest(),
adLoadCallback: InterstitialAdLoadCallback(
onAdLoaded: (InterstitialAd ad) {
print('$ad carregado');
_interstitialAd = ad;
View exemplo_googleads_banner.dart
BannerAd? _bannerAd;
void _createBannerAd() {
_bannerAd = BannerAd(
size: AdSize.banner,
adUnitId: Constants.ADMOB_TEST_BANNER_ID,
listener: BannerAdListener(
onAdLoaded: (Ad ad) {
print('$BannerAd carregado.');
},
View exemplo_googleads_init.dart
void main() {
WidgetsFlutterBinding.ensureInitialized();
MobileAds.instance.initialize();
runApp(MyApp());
}
View exemplo_googleads_androidmainfest.xml
<manifest>
<application>
<!-- Exemplo AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
</application>
</manifest>