Jump to content

Haai5

Members
  • Content Count

    4
  • Joined

  • Last visited

Everything posted by Haai5

  1. Haai5

    Wake up!

    Hi, I am looking for Delphi examples on waking up an application when an Android device is in sleep mode. Setting an alarm with the AlarmManager TAndroidHelper.AlarmManager.&set(TJAlarmManager.JavaClass.RTC_WAKEUP,...) fires MyAppEvent on time, it writes a message in the Memo, but the app does NOT wake up. function TfrMain.MyAppEvent(aAppEvent: TApplicationEvent; AContext: TObject): Boolean; begin result := False; case aAppEvent of TApplicationEvent.BecameActive: memo1.Lines.Add('BecameActive'); ... Only when I manually wake up the device, I see the app appear on screen. How can wake up the device when MyAppEvent notifies the event of becoming active? Even more, the app should become on the front of other running applications in the case the device is not asleep. I've searched already on the possibilities of the AlarmManager and the PowerManager, but found nothing to wake up while being asleep. Any example would be appreciated!
  2. Haai5

    BannerAd doesn't load

    When creating the example app for showing a TBannerAd is in http://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_the_AdMob_Service , it takes a long time before the form is opened, and no banner is shown. I have made my app exactly as in the example, except for my own BannerAd1.AdUnitID. Yes, I have set Project | Options | Application | Entitlement List | AdMob service to TRUE, and yes, I do have internet access. What am I missing? Embarcadero® Delphi 10.3 Community Edition for target Android 64bit.
  3. Haai5

    BannerAd doesn't load

    SOLVED! I made a typo for the banner component name on the Google AdMob website! The banner still loads very slow, though! And the banner does not load when TestMode property is set to False. What is the purpose/effect of this property?
  4. Haai5

    BannerAd doesn't load

    I add some screen shots and the code. I think I did all I had to do as the example indicates? unit BannerAdTestUnit; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Controls.Presentation, FMX.StdCtrls, FMX.Advertising; type TForm1 = class(TForm) BannerAd1: TBannerAd; Label1: TLabel; procedure FormShow(Sender: TObject); procedure BannerAd1ActionCanBegin(Sender: TObject; var WillLeaveApplication: Boolean); procedure BannerAd1ActionDidFinish(Sender: TObject); private { Private declarations } ActionBeginDate: TDateTime; WastedSeconds: Integer; public { Public declarations } end; var Form1: TForm1; implementation {$R *.fmx} uses System.DateUtils; procedure TForm1.BannerAd1ActionCanBegin(Sender: TObject; var WillLeaveApplication: Boolean); begin ActionBeginDate := Now; end; procedure TForm1.BannerAd1ActionDidFinish(Sender: TObject); var Seconds: Integer; begin Seconds := SecondsBetween(ActionBeginDate, Now); WastedSeconds := WastedSeconds + Seconds; Label1.Text := IntToStr(WastedSeconds) + ' seconds wasted watching ads so far.' end; procedure TForm1.FormShow(Sender: TObject); begin if BannerAd1.AdUnitID = '' then BannerAd1.AdUnitID := 'ca-app-pub-3004682421148914~2744794599' ; BannerAd1.LoadAd end; end.
×