Basic4Android · B4A
کلاس آماده BASIC، نمایش درون صفحه و تمامصفحه در Android.
سه قدم تا اولین تبلیغ Basic4Android · B4A
- رسانه و جایگاه همان فرمت را ثبت و تأیید کنید.
- بسته همین پلتفرم را نصب کنید.
- شناسه UNT_ مثال را با شناسه جایگاه خود جایگزین کنید.
نشانی HTTPS در مثال، سرور خود دیدنکس است. در حالت مستقیم، JWT، کلید خصوصی و ورود کاربر لازم نیست. Android، iOS، Unity و B4A شناسه بسته را از خود اپ میخوانند؛ Flutter نیز در initialize جدید، شناسه بسته را محلی میخواند؛ ورود دستی در روش سازگار قدیمی ممکن است. تغییر دامنه دیدنکس فقط به تغییر همین نشانی در تنظیم اپ نیاز دارد.
۱. نصب و تنظیم اولیه
DidnexAds.bas و DidnexPush.bas را از همین ZIP با Project → Add Existing Modules بهعنوان Class Module اضافه کنید؛ نام ماژولها دقیقاً DidnexAds و DidnexPush باشد. کتابخانههای OkHttpUtils2، OkHttp، JSON، JavaObject و Audio را فعال کنید. Main.bas همراه، Activity کامل انتخاب ۱۳ فرمت است. برای Inbox کلاس DidnexPush.bas را نیز اضافه کنید؛ Firebase فقط برای پوش پسزمینه انتخابی است.
B4A با پشتیبانی ResumableSub و inline Java؛ نمونه metadata نسخه 13 دارد. کلاس را با Initialize از Activity یا B4XPage مالک بسازید؛ InitializeDirect و Connect قدیمی حذف شدهاند. آرگومان چهارم در اتصال مستقیم Application.PackageName و در پراکسی نشانی HTTPS دیدنکس است. هر کلاس یک تبلیغ همزمان دارد؛ برای بنر و تمامصفحه دو نمونه جدا بسازید. در نسخه فنی 0.17.1 خطای فنی با noFill متفاوت است؛ Handler نمونه، sdkVersion، code، stage، operation، exception، frame، line و httpStatus را در Logs ثبت میکند. media_unavailable در نسخه قبلی از Catch عمومی بود و الزاماً خرابی ویدیو را نشان نمیداد. کلاس را جایگزین و Clean Project کنید؛ داده نصب را پاک نکنید. IntegrityProvider پیشفرض Null است؛ اعتبارسنجی بومی فقط با تنظیم provider دارای Proof فعال میشود. سیاست اعتبارسنجی سرور مستقل از این گزینه اعمال میشود. ظاهر 0.17.1: ویدیوی معمولی هنگام آمادهبودن و حداقل ۵۰٪ دیدهشدن، خودکار و بیصدا پخش میشود؛ دکمه شروع لازم نیست. نشان دیدنکس روی قاب است، لمس بدنه و دکمه مقصد مشترک دارند و صدا/توقف کنترل مستقل دارند. صوت و جایزه نیازمند اقدام کاربرند. AutoPlayVideo=False پخش خودکار را خاموش میکند. کارت نسبت واقعی محتوا را حفظ میکند و رویداد loaded دارای heightPx پیشنهادی ظرف است. برای مدیریت ظاهر از پنل، سرور 8.8.0 و SDK جدید لازم است؛ سرور قبلی با ظاهر پیشفرض سازگار است.
' Globals: Private Ads As DidnexAds
' Activity_Create:
Ads.Initialize(Me,"Ads","https://didnex.com",Application.PackageName)
' Inside a resumable sub, after creating a Panel of height >=180dip:
Wait For (Ads.ShowBanner("UNT_BANNER",BannerPanel)) Complete (Shown As Boolean)
' Activity_Pause: Ads.SetActive(False)
' Activity_Resume: Ads.SetActive(True)
' Permanent removal: Ads.Closeراهاندازی یکباره تبلیغ و پوش
نمونه کوتاه زیر فقط تنظیم اولیه است؛ callback و ظرف نمایش را در مثال کامل همین صفحه ببینید. init اجازه اعلان نمیگیرد و عضویت خودکار ندارد. یک کلاینت را برای عمر اپ نگه دارید و همان را برای تبلیغ و پوش استفاده کنید.
Sub Globals
Private Const PlacementId As String = "PASTE_YOUR_PLACEMENT_ID_HERE"
Private Client As Didnex
Private Push As DidnexPush
End Sub
Sub Activity_Create(FirstTime As Boolean)
Client.Initialize(Me,"Ads")
Push = Client.CreatePush(PlacementId,Me,"Push")
' Client.Ads.ShowBanner(PlacementId, Panel) for inline formats.
' Client.Ads.ShowInterstitial / ShowRewarded for fullscreen formats.
End Sub
Sub Ads_Event(Detail As Map)
Log(Detail.GetDefault("type",""))
End Subاندازه ثابت جایگاه
اندازه از slot جایگاه تعیین میشود؛ تصویر و ویدیو با contain داخل همان کادرند. ابعاد فایل یا آمادهشدن ویدیو، اندازه بیرونی را عوض نمیکند. noFill و خطا کادر را جمع میکنند. در Unity و Godot مستطیل میزبان را مطابق پروفایل انتخاب کنید.
| پروفایل دیدنکس | اندازه مرجع | نوار ثابت زیر رسانه |
|---|---|---|
| بنر استاندارد ۳۲۰ × ۵۰ | 320 × 50 | ندارد |
| بنر بزرگ ۳۲۰ × ۱۰۰ | 320 × 100 | ندارد |
| بنر مستطیل ۳۰۰ × ۲۵۰ | 300 × 250 | ندارد |
| بنر عریض ۷۲۸ × ۹۰ | 728 × 90 | ندارد |
| بنر تطبیقی با نسبت ۳۲۰ × ۵۰ | 320 × 50 | ندارد |
| همسان افقی ۱۶:۹ + نوار ثابت | 640 × 360 | 84 پیکسل منطقی |
| همسان مربع + نوار ثابت | 600 × 600 | 84 پیکسل منطقی |
| ویدیوی همسان ۱۶:۹ + نوار ثابت | 640 × 360 | 84 پیکسل منطقی |
| ویدیوی درون محتوا ۱۶:۹ | 640 × 360 | ندارد |
| کاروسل ۱۶:۹ با نوار ثابت | 640 × 360 | 84 پیکسل منطقی |
| نظرسنجی در کادر ثابت | 320 × 300 | 84 پیکسل منطقی |
| کارت صوتی ثابت | 320 × 96 | ندارد |
| تمامصفحه با حاشیه امن | 360 × 640 | 84 پیکسل منطقی |
| تمامصفحه با حاشیه امن | 360 × 640 | 84 پیکسل منطقی |
| تمامصفحه با حاشیه امن | 360 × 640 | 84 پیکسل منطقی |
| تمامصفحه با حاشیه امن | 360 × 640 | 84 پیکسل منطقی |
| تمامصفحه با حاشیه امن | 360 × 640 | 84 پیکسل منطقی |
اینها پروفایل محصول دیدنکساند؛ گواهی استاندارد یا یک اندازه پیکسلی جهانی برای همه فرمتها نیستند. حداقل وضوح در فرم کمپین کنترل میشود. برای فعالشدن renderer جدید در اپ نصبشده، یک بار SDK را بهروزرسانی کنید.
فونت و ظاهر مشترک
ظاهر کارت در هر دو روش مستقیم و پراکسی از پاسخ همان تبلیغ خوانده میشود. مدیر در تنظیمات ← ظاهر تبلیغ و SDK، رنگ، زمینه، فونت، گردی کارت، جای نشان و پخش خودکار ویدیوی معمولی را تعیین میکند. ابتدا یکبار SDK و اپ را بهروزرسانی کنید؛ سپس تغییرات پشتیبانیشده در درخواست بعدی تبلیغ اعمال میشوند. فونت Noto Sans Arabic فارسی و لوگو از سرور خود دیدنکس کش میشوند؛ خطای این داراییهای اختیاری باعث noFill یا خطای تبلیغ نمیشود. Unity برای UGUI یک فونت کوچک فارسی همراه و شکلدهی حروف در مرز نمایش دارد. سرور کد اجرایی جدید به اپ نمیفرستد.
ویدیوی معمولی هنگام دیدهشدن خودکار و بیصداست؛ صوت و جایزه با انتخاب کاربر شروع میشوند. دامنه دیدنکس را در font-src سیاست CSP وب مجاز کنید.
۲. Manifest و مجوزهای لازم
قطعه زیر را با فایل موجود ادغام کنید. INTERNET باید در Manifest اصلی نسخه Release هم باشد. تبلیغ پایه به مجوز مکان، اعلان، حافظه یا شناسه تبلیغاتی نیاز ندارد.
' Add these lines in B4A Manifest Editor, preserving your existing entries.
AddPermission(android.permission.INTERNET)
AddPermission(android.permission.ACCESS_NETWORK_STATE)
' Inbox/ads need no notification, storage, location or advertising-ID permission.
' For optional background FCM only: also follow sdk/push/b4a/README.md.
' Optional system push: merge integrations/Manifest.txt only after installing FirebaseNotifications.
در iOS فایل PrivacyInfo.xcprivacy بسته را به منابع Target اضافه کنید؛ HTTPS به غیرفعالکردن ATS نیاز ندارد. UIBackgroundModes فقط برای پوش پسزمینه اختیاری است. در Unity دسترسی اینترنت Player Settings را روی Require قرار دهید.
بازکردن جایگاه و راهنمای قدمبهقدم اتصال — در پنل، نمونه با شناسه و بستهٔ رسانهٔ شما ساخته میشود؛ تست تا دریافت گزارش همان جلسه ادامه دارد.
۳. مثال کامل هر فرمت
هر شناسه جایگاه فقط یک فرمت دارد؛ فرمت باید با نوع رسانه و سیاستهای پنل سازگار باشد. مثال کامل همان فرمت را انتخاب کنید. تمامصفحه فقط در نقطه طبیعی تجربه کاربر نمایش داده شود. ویدیوی معمولی خودکار و بیصداست؛ صوت و جایزه با اقدام کاربر شروع میشوند.
بنر · درون صفحه
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("banner":"UNT_BANNER")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("banner"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://didnex.com",Application.PackageName)
FullAds.Initialize(Me,"FullAds","https://didnex.com",Application.PackageName)
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
روش سروری اختیاری همین فرمت
فقط برای اپ دارای سرور: نشانی پراکسی و تابع نشست فعلی اپ را تکمیل کنید. تابع خالی نمونه، نشست واقعی ایجاد نمیکند. کلید خصوصی روی سرور میماند.
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("banner":"UNT_BANNER")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("banner"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
FullAds.Initialize(Me,"FullAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
' Connect these callbacks to your current authenticated app session.
Sub InlineAds_SessionToken As String
Return ""
End Sub
Sub FullAds_SessionToken As String
Return ""
End Sub
بنر تطبیقی · درون صفحه
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("adaptive_banner":"UNT_ADAPTIVE_BANNER")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("adaptive_banner"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://didnex.com",Application.PackageName)
FullAds.Initialize(Me,"FullAds","https://didnex.com",Application.PackageName)
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
روش سروری اختیاری همین فرمت
فقط برای اپ دارای سرور: نشانی پراکسی و تابع نشست فعلی اپ را تکمیل کنید. تابع خالی نمونه، نشست واقعی ایجاد نمیکند. کلید خصوصی روی سرور میماند.
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("adaptive_banner":"UNT_ADAPTIVE_BANNER")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("adaptive_banner"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
FullAds.Initialize(Me,"FullAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
' Connect these callbacks to your current authenticated app session.
Sub InlineAds_SessionToken As String
Return ""
End Sub
Sub FullAds_SessionToken As String
Return ""
End Sub
همسان · درون صفحه
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("native":"UNT_NATIVE")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("native"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://didnex.com",Application.PackageName)
FullAds.Initialize(Me,"FullAds","https://didnex.com",Application.PackageName)
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
روش سروری اختیاری همین فرمت
فقط برای اپ دارای سرور: نشانی پراکسی و تابع نشست فعلی اپ را تکمیل کنید. تابع خالی نمونه، نشست واقعی ایجاد نمیکند. کلید خصوصی روی سرور میماند.
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("native":"UNT_NATIVE")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("native"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
FullAds.Initialize(Me,"FullAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
' Connect these callbacks to your current authenticated app session.
Sub InlineAds_SessionToken As String
Return ""
End Sub
Sub FullAds_SessionToken As String
Return ""
End Sub
ویدیوی همسان · درون صفحه
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("native_video":"UNT_NATIVE_VIDEO")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("native_video"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://didnex.com",Application.PackageName)
FullAds.Initialize(Me,"FullAds","https://didnex.com",Application.PackageName)
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
روش سروری اختیاری همین فرمت
فقط برای اپ دارای سرور: نشانی پراکسی و تابع نشست فعلی اپ را تکمیل کنید. تابع خالی نمونه، نشست واقعی ایجاد نمیکند. کلید خصوصی روی سرور میماند.
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("native_video":"UNT_NATIVE_VIDEO")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("native_video"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
FullAds.Initialize(Me,"FullAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
' Connect these callbacks to your current authenticated app session.
Sub InlineAds_SessionToken As String
Return ""
End Sub
Sub FullAds_SessionToken As String
Return ""
End Sub
ویدیوی درون محتوا · درون صفحه
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("video":"UNT_VIDEO")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("video"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://didnex.com",Application.PackageName)
FullAds.Initialize(Me,"FullAds","https://didnex.com",Application.PackageName)
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
روش سروری اختیاری همین فرمت
فقط برای اپ دارای سرور: نشانی پراکسی و تابع نشست فعلی اپ را تکمیل کنید. تابع خالی نمونه، نشست واقعی ایجاد نمیکند. کلید خصوصی روی سرور میماند.
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("video":"UNT_VIDEO")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("video"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
FullAds.Initialize(Me,"FullAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
' Connect these callbacks to your current authenticated app session.
Sub InlineAds_SessionToken As String
Return ""
End Sub
Sub FullAds_SessionToken As String
Return ""
End Sub
بینابینی · تمامصفحه
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("interstitial":"UNT_INTERSTITIAL")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("interstitial"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://didnex.com",Application.PackageName)
FullAds.Initialize(Me,"FullAds","https://didnex.com",Application.PackageName)
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
روش سروری اختیاری همین فرمت
فقط برای اپ دارای سرور: نشانی پراکسی و تابع نشست فعلی اپ را تکمیل کنید. تابع خالی نمونه، نشست واقعی ایجاد نمیکند. کلید خصوصی روی سرور میماند.
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("interstitial":"UNT_INTERSTITIAL")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("interstitial"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
FullAds.Initialize(Me,"FullAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
' Connect these callbacks to your current authenticated app session.
Sub InlineAds_SessionToken As String
Return ""
End Sub
Sub FullAds_SessionToken As String
Return ""
End Sub
ویدیوی جایزهدار · جایزهدار
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("rewarded":"UNT_REWARDED")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("rewarded"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://didnex.com",Application.PackageName)
FullAds.Initialize(Me,"FullAds","https://didnex.com",Application.PackageName)
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
روش سروری اختیاری همین فرمت
فقط برای اپ دارای سرور: نشانی پراکسی و تابع نشست فعلی اپ را تکمیل کنید. تابع خالی نمونه، نشست واقعی ایجاد نمیکند. کلید خصوصی روی سرور میماند.
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("rewarded":"UNT_REWARDED")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("rewarded"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
FullAds.Initialize(Me,"FullAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
' Connect these callbacks to your current authenticated app session.
Sub InlineAds_SessionToken As String
Return ""
End Sub
Sub FullAds_SessionToken As String
Return ""
End Sub
بینابینی جایزهدار · جایزهدار
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("rewarded_interstitial":"UNT_REWARDED_INTERSTITIAL")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("rewarded_interstitial"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://didnex.com",Application.PackageName)
FullAds.Initialize(Me,"FullAds","https://didnex.com",Application.PackageName)
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
روش سروری اختیاری همین فرمت
فقط برای اپ دارای سرور: نشانی پراکسی و تابع نشست فعلی اپ را تکمیل کنید. تابع خالی نمونه، نشست واقعی ایجاد نمیکند. کلید خصوصی روی سرور میماند.
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("rewarded_interstitial":"UNT_REWARDED_INTERSTITIAL")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("rewarded_interstitial"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
FullAds.Initialize(Me,"FullAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
' Connect these callbacks to your current authenticated app session.
Sub InlineAds_SessionToken As String
Return ""
End Sub
Sub FullAds_SessionToken As String
Return ""
End Sub
آغاز اپ · تمامصفحه
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("app_open":"UNT_APP_OPEN")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("app_open"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://didnex.com",Application.PackageName)
FullAds.Initialize(Me,"FullAds","https://didnex.com",Application.PackageName)
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
روش سروری اختیاری همین فرمت
فقط برای اپ دارای سرور: نشانی پراکسی و تابع نشست فعلی اپ را تکمیل کنید. تابع خالی نمونه، نشست واقعی ایجاد نمیکند. کلید خصوصی روی سرور میماند.
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("app_open":"UNT_APP_OPEN")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("app_open"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
FullAds.Initialize(Me,"FullAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
' Connect these callbacks to your current authenticated app session.
Sub InlineAds_SessionToken As String
Return ""
End Sub
Sub FullAds_SessionToken As String
Return ""
End Sub
بازی تعاملی · تمامصفحه
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("playable":"UNT_PLAYABLE")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("playable"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://didnex.com",Application.PackageName)
FullAds.Initialize(Me,"FullAds","https://didnex.com",Application.PackageName)
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
روش سروری اختیاری همین فرمت
فقط برای اپ دارای سرور: نشانی پراکسی و تابع نشست فعلی اپ را تکمیل کنید. تابع خالی نمونه، نشست واقعی ایجاد نمیکند. کلید خصوصی روی سرور میماند.
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("playable":"UNT_PLAYABLE")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("playable"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
FullAds.Initialize(Me,"FullAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
' Connect these callbacks to your current authenticated app session.
Sub InlineAds_SessionToken As String
Return ""
End Sub
Sub FullAds_SessionToken As String
Return ""
End Sub
صوتی · درون صفحه
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("audio":"UNT_AUDIO")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("audio"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://didnex.com",Application.PackageName)
FullAds.Initialize(Me,"FullAds","https://didnex.com",Application.PackageName)
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
روش سروری اختیاری همین فرمت
فقط برای اپ دارای سرور: نشانی پراکسی و تابع نشست فعلی اپ را تکمیل کنید. تابع خالی نمونه، نشست واقعی ایجاد نمیکند. کلید خصوصی روی سرور میماند.
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("audio":"UNT_AUDIO")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("audio"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
FullAds.Initialize(Me,"FullAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
' Connect these callbacks to your current authenticated app session.
Sub InlineAds_SessionToken As String
Return ""
End Sub
Sub FullAds_SessionToken As String
Return ""
End Sub
کاروسلی · درون صفحه
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("carousel":"UNT_CAROUSEL")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("carousel"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://didnex.com",Application.PackageName)
FullAds.Initialize(Me,"FullAds","https://didnex.com",Application.PackageName)
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
روش سروری اختیاری همین فرمت
فقط برای اپ دارای سرور: نشانی پراکسی و تابع نشست فعلی اپ را تکمیل کنید. تابع خالی نمونه، نشست واقعی ایجاد نمیکند. کلید خصوصی روی سرور میماند.
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("carousel":"UNT_CAROUSEL")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("carousel"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
FullAds.Initialize(Me,"FullAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
' Connect these callbacks to your current authenticated app session.
Sub InlineAds_SessionToken As String
Return ""
End Sub
Sub FullAds_SessionToken As String
Return ""
End Sub
نظرسنجی · درون صفحه
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("poll":"UNT_POLL")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("poll"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://didnex.com",Application.PackageName)
FullAds.Initialize(Me,"FullAds","https://didnex.com",Application.PackageName)
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
روش سروری اختیاری همین فرمت
فقط برای اپ دارای سرور: نشانی پراکسی و تابع نشست فعلی اپ را تکمیل کنید. تابع خالی نمونه، نشست واقعی ایجاد نمیکند. کلید خصوصی روی سرور میماند.
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("poll":"UNT_POLL")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("poll"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
FullAds.Initialize(Me,"FullAds","https://YOUR-BACKEND.example/ads","https://didnex.com")
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
InlineAds.DiagnosticToken = ""
FullAds.DiagnosticToken = ""
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
' Connect these callbacks to your current authenticated app session.
Sub InlineAds_SessionToken As String
Return ""
End Sub
Sub FullAds_SessionToken As String
Return ""
End Sub
۴. مثال کامل با مدیریت خطا
این مثال عیناً از فایل sdk/b4a/Examples/Main.bas داخل بسته ساخته میشود. نام package نمونه، شناسههای UNT_ و ظرف نمایش را با اپ خود هماهنگ کنید. برای بنر و تمامصفحه از نمونه جدا استفاده کنید.
نمایش مثال کامل Basic4Android · B4A
B4A=true
Group=Example
ModulesStructureVersion=1
Type=Activity
Version=13.0
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Didnex
#VersionCode: 1
#VersionName: 1
#SupportedOrientations: unspecified
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private InlineAds, FullAds As DidnexAds
Private BannerPanel, FullPanel As Panel
Private FormatSelect As Spinner
Private Units As Map
Private RequestBusy As Boolean
Private ShowButton As Button
Private Status As Label
Private LastFailure As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color = Colors.White
Units = CreateMap("banner":"UNT_BANNER","adaptive_banner":"UNT_ADAPTIVE_BANNER","native":"UNT_NATIVE","native_video":"UNT_NATIVE_VIDEO","video":"UNT_VIDEO","interstitial":"UNT_INTERSTITIAL","rewarded":"UNT_REWARDED","rewarded_interstitial":"UNT_REWARDED_INTERSTITIAL","app_open":"UNT_APP_OPEN","playable":"UNT_PLAYABLE","audio":"UNT_AUDIO","carousel":"UNT_CAROUSEL","poll":"UNT_POLL")
FormatSelect.Initialize("")
FormatSelect.AddAll(Array As String("banner","adaptive_banner","native","native_video","video","interstitial","rewarded","rewarded_interstitial","app_open","playable","audio","carousel","poll"))
Activity.AddView(FormatSelect,0,0,100%x,48dip)
ShowButton.Initialize("ShowButton")
ShowButton.Text = "نمایش تبلیغ"
Activity.AddView(ShowButton,0,48dip,100%x,48dip)
Status.Initialize("")
Activity.AddView(Status,0,96dip,100%x,48dip)
BannerPanel.Initialize("")
Activity.AddView(BannerPanel,0,144dip,100%x,Max(180dip,100%y-144dip))
FullPanel.Initialize("")
FullPanel.Color = 0xE60B1020
Activity.AddView(FullPanel,0,0,100%x,100%y)
FullPanel.Visible = False
' No backend, app login, JWT or private key.
InlineAds.Initialize(Me,"InlineAds","https://didnex.com",Application.PackageName)
FullAds.Initialize(Me,"FullAds","https://didnex.com",Application.PackageName)
' Native attestation is optional; enable only with a configured Proof provider.
InlineAds.IntegrityProvider = Null
FullAds.IntegrityProvider = Null
End Sub
Private Sub ShowButton_Click
If RequestBusy Or FullPanel.Visible Then Return
RequestBusy = True
ShowButton.Enabled = False
LastFailure = ""
Status.Text = "در حال دریافت تبلیغ…"
Dim Format As String = FormatSelect.SelectedItem
Dim UnitId As String = Units.Get(Format)
' Replace the UNT_ values with approved unit IDs from your panel.
Dim IsReward As Boolean = Format = "rewarded" Or Format = "rewarded_interstitial"
Dim IsFull As Boolean = IsReward Or Format = "interstitial" Or Format = "app_open" Or Format = "playable"
If IsFull Then
FullPanel.Visible = False
If IsReward Then
Wait For (FullAds.ShowRewarded(UnitId,FullPanel)) Complete (RewardShown As Boolean)
FullPanel.Visible = RewardShown
Else
Wait For (FullAds.ShowInterstitial(UnitId,FullPanel)) Complete (FullShown As Boolean)
FullPanel.Visible = FullShown
End If
Else
InlineAds.Close
BannerPanel.Height = Max(180dip,100%y-144dip)
Wait For (InlineAds.ShowBanner(UnitId,BannerPanel)) Complete (InlineShown As Boolean)
If InlineShown = False Then
BannerPanel.Height = 0
If LastFailure = "" Then Status.Text = "نمایش کامل نشد؛ خروجی Logs را بررسی کنید"
End If
End If
RequestBusy = False
ShowButton.Enabled = True
End Sub
Sub InlineAds_Event(Detail As Map)
If Detail.GetDefault("type","") = "loaded" And BannerPanel.IsInitialized Then
BannerPanel.Height = Min(Max(180dip,Detail.GetDefault("heightPx",BannerPanel.Height)),Max(180dip,100%y-144dip))
End If
HandleEvent(Detail)
End Sub
Sub FullAds_Event(Detail As Map)
HandleEvent(Detail)
If Detail.GetDefault("type","") = "closed" Then FullPanel.Visible = False
End Sub
Private Sub HandleEvent(Detail As Map)
Dim Kind As String = Detail.GetDefault("type","")
Dim Code As String = Detail.GetDefault("code","")
Log("Didnex sdk=" & Detail.GetDefault("sdkVersion","unknown") & " type=" & Kind & " code=" & Code & " stage=" & Detail.GetDefault("stage","") & " operation=" & Detail.GetDefault("operation","") & " exception=" & Detail.GetDefault("exception","") & " frame=" & Detail.GetDefault("frame","") & " line=" & Detail.GetDefault("line",0) & " http=" & Detail.GetDefault("httpStatus",0))
Select Kind
Case "reward"
Status.Text = "جایزه در کیف نصب دیدنکس ثبت شد"
' Receipt is already applied. Do not credit locally again.
Case "noFill"
LastFailure = Code
Status.Text = "فعلاً تبلیغی در دسترس نیست: " & Code
Case "error"
LastFailure = Code
Status.Text = "خطای اتصال یا نمایش: " & Code & "؛ جزئیات در Logs"
Case "loaded"
Status.Text = "تبلیغ آماده شد"
End Select
End Sub
Sub Activity_Resume
InlineAds.SetActive(True)
FullAds.SetActive(True)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
InlineAds.SetActive(False)
FullAds.SetActive(False)
If UserClosed Then
InlineAds.Close
FullAds.Close
End If
End Sub
۵. نبود تبلیغ، قطعی شبکه و چرخه عمر
آغاز اپ را منتظر تبلیغ نگه ندارید. noFill وضعیت عادی است؛ فضای تبلیغ را مخفی کنید و اپ ادامه یابد. درخواست پشت سر هم و retry بیوقفه انجام ندهید. هنگام حذف صفحه، handle یا view را مطابق مثال ببندید. در تب پنهان یا پوشش سفارشی، active را false کنید. نمایش خودکار روی هر resume مناسب نیست.
۶. جایزه، کیف و پوش
جایزه فقط پس از انتخاب کاربر، تماشای کامل و رسید verified و applied سرور معتبر است. callback یعنی جایزه پیشتر در کیف نصب دیدنکس ثبت شده؛ دوباره به موجودی اضافه نکنید. برای مصرف، externalId را پیش از ارسال ذخیره و در retry ثابت نگه دارید. کیف نصب، حساب قابل بازیابی چنددستگاهی نیست.
Inbox بدون Firebase و در اپ فعال کار میکند. پوش پسزمینه به رضایت کاربر، مجوز سیستمعامل و اتصال FCM/APNs/Web Push نیاز دارد؛ فعالکردن تبلیغ به این تنظیمها وابسته نیست. همه ۱۳ فرمت اتصال مستقیم دارند؛ React Native و Godot فعلاً مستقیم هستند و شش SDK اصلی پراکسی اختیاری هم دارند.
۷. آزمون و رفع خطا
diagnosticToken پنل، با فایل واقعی متناسب با فرمت (تصویر، ویدیو، صوت یا بازی) تست بدون هزینه و جایزه میدهد؛ تأیید تحویل مالی نیست. برای تبلیغ واقعی، کمپین سازگار با بودجه و رسانه فعال لازم است. در خطای package، پسوند flavor خروجی را با رسانه تطبیق دهید؛ در وب Origin دقیق و HTTPS را بررسی کنید. خطای سرویس را با موفقیت مالی یا جایزه محلی جایگزین نکنید.
پیش از انتشار اپ، ساخت Release، قطع شبکه، DNS نامعتبر، پاسخ خراب، خروج صفحه وسط درخواست، پسزمینه و تکرار claim را روی دستگاه هدف بررسی کنید. مسیر ساخت تکرارپذیر و تستهای هر SDK همراه سورس هستند.
قابلیتهای SDK جدید و عیبیاب داخل اپ
نسخه نمایشی این انتشار ۱ است؛ شماره فنی و هش هر بسته در مرکز SDK درج شده است. هر ۱۱ فرمت در اتصال مستقیم و سرور اختیاری پشتیبانی میشوند؛ playable با helper بینابینی نمایش داده میشود و نیازمند SDK جدید است. در «لابراتوار تبلیغ»، بازی را بسازید و کمپین/جایگاه با فرمت playable انتخاب کنید. قالبهای همان بازی در Flutter/Unity بومی رسم میشوند؛ وب و Kotlin/Swift/B4A از محیط HTML5 محدود استفاده میکنند.
برای عیبیاب، از پنل ناشر توکن تست جایگاه بگیرید و همان درخواست تست را اجرا کنید. در Flutter حالت debug، Android اپ debuggable، Swift ساخت DEBUG و Unity ساخت Development نیز مجازند. گزارش فقط محلی و محدود به ۸۰ رخداد، زمان، خطا، نوع رسانه و کیفیت است؛ کلید، JWT، URL امضاشده و شناسه مخاطب ثبت نمیشود. خروجی کپی را خودتان برای پشتیبانی میفرستید.
Ads.ShowInspectorخروجیهای ویدیوی تطبیقی بهطور خودکار از mediaSources انتخاب میشوند. حالت کممصرف/شبکه موبایل کیفیت پایین، Wi-Fi یا شبکه سریع کیفیت بالاتر و شبکه نامشخص کیفیت میانی میگیرد. اجازه ACCESS_NETWORK_STATE در Android برای تشخیص شبکه لازم است؛ در نبود دسترسی، انتخاب محافظهکارانه انجام میشود. رویداد بارگذاری، نمایش قابل مشاهده، پیشرفت ویدیو و تأیید جایزه همچنان از مسیر امضاشده میگذرند؛ عیبیاب درآمد ایجاد نمیکند.
ابزارهای ساخت موبایل و دستگاه واقعی در محیط انتشار این سورس در دسترس نبودند. آزمون قرارداد سرور، رمزنگاری، تولید رسانه و پنل انجام شده؛ پیش از انتشار اپ، ساخت SDK در Flutter/Xcode/Android Studio/Unity/B4A و آزمون دستگاه را انجام دهید. بستهها روی pub.dev یا فروشگاهها منتشر نشدهاند.