[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[dji8-ios] 02 App Registration

"Report the status of SDK registration"
DJISDKManager hasSDKRegistered
  ifTrue: [ self print: 'Application is registered' ]
  ifFalse: [ self print: 'The SDK is not registered' ]


"Register the app (if not already registered)"
| done timeout text |
DJISDKManager hasSDKRegistered ifTrue: [ ^self ].
self print: 'Registering application...'.
DJISDKManagerDelegate
   registerApp: [ done := true ]
   onError: [:err|
     text := 'Error ', err "description"toString.
     done := true
   ].
timeout := 1 * 60 * 1000 + DateTime now asMilliseconds.
[done = true] whileFalse: [
  (text notNil or: [ DateTime now asMilliseconds > timeout])
  ifTrue: [
    text notNil ifTrue: [ self print: '// ' ,text ] ifFalse: [
      self print: '// WARNING: Timeout reached without resolving registration' ].
    ^self
  ]
].