I write a smal app to test fetch download but the "Private Sub Application_FetchDownload" was called once in Iphone 4S ( IOS 9.3.5 ) and in an Iphone 6 ( IOS 11.2.6 ) never.
The app is in attach if someone can help me.
I´m trying to find a alternative way to receive an alarm.
The main.m is saved in Files/Special
The app is in attach if someone can help me.
I´m trying to find a alternative way to receive an alarm.
The main.m is saved in Files/Special
B4X:
#Region Project Attributes
#ApplicationLabel: B4i Example
#Version: 1.0.0
'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
#iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
#iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
#Target: iPhone, iPad
#ATSEnabled: True
#MinVersion: 7
#PlistExtra: <key>UIBackgroundModes</key><array><string>fetch</string></array>
#CertificateFile: ios_distribution_2018.cer
#ProvisionFile: ios_ad_hoc_2018.mobileprovision
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page
Private Button1 As Button
End Sub
Private Sub Application_Start (Nav As NavigationController)
'SetDebugAutoFlushLogs(True) 'Uncomment if program crashes before all logs are printed.
NavControl = Nav
Page1.Initialize("Page1")
Page1.Title = "Page 1"
Page1.RootPanel.Color = Colors.White
NavControl.ShowPage(Page1)
Page1.RootPanel.LoadLayout("main")
Dim rl As ReleaseLogger
rl.Initialize("192.168.2.102", 54323)
App.RegisterUserNotifications(True,True,True)
App.ApplicationIconBadgeNumber=0
Dim no As NativeObject = App
no.RunMethod("setMinimumBackgroundFetchInterval:", Array(0)) '0 = minimum interval
End Sub
Private Sub Page1_Resize(Width As Int, Height As Int)
End Sub
Private Sub Application_Background
End Sub
Private Sub Application_FetchDownload
Log("FetchDownload " & App.OSVersion & " (IOS) ")
Dim ln As Notification
ln.Initialize(DateTime.Now)
ln.AlertBody = "Fetch download..." & App.OSVersion & " (IOS) "
ln.PlaySound = True
ln.Register
Dim xdata As String
DateTime.DateFormat = "dd/MM/yyyy HH:mm:ss"
xdata = DateTime.Date (DateTime.Now )
Log ( "**** Fetch " & App.OSVersion & " (IOS) - " & xdata )
App.ApplicationIconBadgeNumber=2
Sleep(5000)
Dim no As NativeObject = App
no = no.GetField("delegate")
no.RunMethod("completeFetch:", Array(0))
End Sub
Sub Button1_Click
Dim xdata As String
DateTime.DateFormat = "dd/MM/yyyy HH:mm:ss"
xdata = DateTime.Date (DateTime.Now )
Log ( "**** Teste " & App.OSVersion & " (IOS) - " & xdata )
End Sub