-
Content Count
1489 -
Joined
-
Last visited
-
Days Won
36
Everything posted by Dave Nottage
-
1. You don't need to add the classes.dex file to the project, nor the .java files 2. The UseAsJar.java file is missing the package directive which by convention is a domain in reverse order followed by a package identifier, e.g. com.mydomain.mypackage. Also, you do not need a main method, unless you're intending to run the jar separately. 3. Your import (android.JNI.UseAsJAR) is incorrect, since the signature for JUseAsJar does not match the package/class. It should be the package name followed by the class name e.g. com/mydomain/mypackage/UseAsJar. You don't need RegisterTypes, either; I believe that's a hangover from earlier versions of Delphi. 4. Once you've recompiled the .jar, add it to the project, in Project Manager under Target Platforms > Android. This saves having to manually deploy the classes.dex. You could then remove that manual addition. I'd also recommend updating to Delphi 10.3.3
-
Deploying macOS apps with App Store configuration
Dave Nottage replied to Dave Nottage's topic in Delphi IDE and APIs
I expect you mean certificate update? Recently as in a couple of months ago, yes, however I removed the old ones. The provisioning page for macOS is very different from iOS - you need to manually type in the developer certificate name (and installer certificate name if one applies), and cannot even select a provisioning profile. -
Linking errors with FacebookAudienceNetwork
Dave Nottage replied to Chris Pim's topic in Cross-platform
Same happens for me. My guess is a bug in ld, since lipo reports that it has arm64. Reported the issue here: https://quality.embarcadero.com/browse/RSP-27697 -
Rio.1 does not save all layout settings
Dave Nottage replied to Sherlock's topic in Delphi IDE and APIs
I'd like to know how you've solved this - it's still a problem for me. -
Delphi is turning 25, and to celebrate, there's a webinar being held this Friday, February 14th (US time). To register for the webinar, please visit: https://embt.co/Delphi25thWebinar
-
You could extend this demo: https://github.com/Embarcadero/RADStudio10.3.3Demos/tree/master/Object Pascal/Mobile Snippets/PhoneDialer Just create a handler for the OnCallStateChanged event of FPhoneDialerService, handle TCallState.Incoming and fetch the call using GetCurrentCalls
-
Yes, the application delegate needs to implement this method: https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623072-application?language=objc This means class_addmethod will need to be called to add it to the delegate (DelphiAppDelegate). It will also need an import for NSUserActivity, one of which follows (no guarantees as to being 100% accurate): NSUserActivityPersistentIdentifier = NSString; TNSUserActivityBlockMethod1 = procedure(inputStream: NSInputStream; outputStream: NSOutputStream; error: NSError) of object; TNSUserActivityBlockMethod2 = procedure of object; NSUserActivityClass = interface(NSObjectClass) ['{412EAEBF-5927-4D01-B83F-69D3B5DFE7B5}'] {class} procedure deleteAllSavedUserActivitiesWithCompletionHandler(handler: TNSUserActivityBlockMethod2); cdecl; [MethodName('deleteSavedUserActivitiesWithPersistentIdentifiers:completionHandler:')] {class} procedure deleteSavedUserActivitiesWithPersistentIdentifiers(persistentIdentifiers: NSArray; handler: TNSUserActivityBlockMethod2); cdecl; end; NSUserActivity = interface(NSObject) ['{B8C2F6C9-31FE-4282-B7CA-98C96E163033}'] function activityType: NSString; cdecl; procedure addUserInfoEntriesFromDictionary(otherDictionary: NSDictionary); cdecl; procedure becomeCurrent; cdecl; function delegate: Pointer; cdecl; function expirationDate: NSDate; cdecl; procedure getContinuationStreamsWithCompletionHandler(completionHandler: TNSUserActivityBlockMethod1); cdecl; function initWithActivityType(activityType: NSString): Pointer; cdecl; procedure invalidate; cdecl; function isEligibleForHandoff: Boolean; cdecl; function isEligibleForPrediction: Boolean; cdecl; function isEligibleForPublicIndexing: Boolean; cdecl; function isEligibleForSearch: Boolean; cdecl; function keywords: NSSet; cdecl; function needsSave: Boolean; cdecl; function persistentIdentifier: NSUserActivityPersistentIdentifier; cdecl; function referrerURL: NSURL; cdecl; function requiredUserInfoKeys: NSSet; cdecl; procedure resignCurrent; cdecl; procedure setDelegate(delegate: Pointer); cdecl; procedure setEligibleForHandoff(eligibleForHandoff: Boolean); cdecl; procedure setEligibleForPrediction(eligibleForPrediction: Boolean); cdecl; procedure setEligibleForPublicIndexing(eligibleForPublicIndexing: Boolean); cdecl; procedure setEligibleForSearch(eligibleForSearch: Boolean); cdecl; procedure setExpirationDate(expirationDate: NSDate); cdecl; procedure setKeywords(keywords: NSSet); cdecl; procedure setNeedsSave(needsSave: Boolean); cdecl; procedure setPersistentIdentifier(persistentIdentifier: NSUserActivityPersistentIdentifier); cdecl; procedure setReferrerURL(referrerURL: NSURL); cdecl; procedure setRequiredUserInfoKeys(requiredUserInfoKeys: NSSet); cdecl; procedure setSupportsContinuationStreams(supportsContinuationStreams: Boolean); cdecl; procedure setTargetContentIdentifier(targetContentIdentifier: NSString); cdecl; procedure setTitle(title: NSString); cdecl; procedure setUserInfo(userInfo: NSDictionary); cdecl; procedure setWebpageURL(webpageURL: NSURL); cdecl; function supportsContinuationStreams: Boolean; cdecl; function targetContentIdentifier: NSString; cdecl; function title: NSString; cdecl; function userInfo: NSDictionary; cdecl; function webpageURL: NSURL; cdecl; end; TNSUserActivity = class(TOCGenericImport<NSUserActivityClass, NSUserActivity>) end; The method implementation should probably be (again no guarantees): class function TApplicationDelegate.applicationContinueUserActivityRestorationHandler(self: id; _cmd: SEL; application: PUIApplication; userActivity: Pointer; restorationHandler: Pointer): Boolean; As far as I know, it doesn't necessarily have to be patched in FMX.Platform.iOS since you should be able to call class_addmethod anywhere, as long as you pass it the correct class function. Hopefully this will give you head start.
- 9 replies
-
- ios
- firemonkey
-
(and 6 more)
Tagged with:
-
class designation question
Dave Nottage replied to David Schwartz's topic in Algorithms, Data Structures and Class Design
(2) is used pretty extensively. In the Delphi source folder (and subfolders) there are 386 instances of it. -
Going (more) insane here.. I have the following test code: uses System.Win.Registry; function SetTokenPrivilege(const APrivilege: string; const AEnable: Boolean): Boolean; var LToken: THandle; LTokenPriv: TOKEN_PRIVILEGES; LPrevTokenPriv: TOKEN_PRIVILEGES; LLength: Cardinal; LErrval: Cardinal; begin Result := False; if OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY, LToken) then try // Get the locally unique identifier (LUID) . if LookupPrivilegeValue(nil, PChar(APrivilege), LTokenPriv.Privileges[0].Luid) then begin LTokenPriv.PrivilegeCount := 1; // one privilege to set case AEnable of True: LTokenPriv.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED; False: LTokenPriv.Privileges[0].Attributes := 0; end; LPrevTokenPriv := LTokenPriv; // Enable or disable the privilege Result := AdjustTokenPrivileges(LToken, False, LTokenPriv, SizeOf(LPrevTokenPriv), LPrevTokenPriv, LLength); end; finally CloseHandle(LToken); end; end; procedure TForm1.Button1Click(Sender: TObject); var LReg: TRegistry; begin if not SetTokenPrivilege('SeBackupPrivilege', True) then Exit; // <====== LReg := TRegistry.Create(KEY_ALL_ACCESS); try LReg.RootKey := HKEY_CURRENT_USER; if not LReg.SaveKey('Software\Microsoft\Notepad', 'C:\Temp\Notepad.reg') then ShowMessage('Could not save'); finally LReg.Free; end; end; Which results in showing the "Could not save" message. Am I missing something obvious?
-
Just out of curiosity: which versions will be supported? From Delphi 2009 and up?
-
Custom TrueType font in FMX Android app?
Dave Nottage replied to Lars Fosdal's topic in Cross-platform
That's the only way of doing it, and it's very trivial to do. https://quality.embarcadero.com/browse/RSP-16741 -
Custom TrueType font in FMX Android app?
Dave Nottage replied to Lars Fosdal's topic in Cross-platform
There's a number of examples if you Google for: custom fonts delphi android -
Linker errors when including Facebook SDK on iOS12
Dave Nottage replied to Hans♫'s topic in Cross-platform
Excellent! There's someone in another post here asking about whether there are updated imports for the FB SDK. Perhaps you can help them, or at least give them an idea as to whether everything still works anyway. (using 4.36) -
If there's a class called that, it's undocumented. If you're after a unique id for the device, you're probably better off using something like this: uses Androidapi.JNI.Provider, Androidapi.Helpers; // **** NOTE: Use this value with care, as it is reset if the device is rooted, or wiped function GetUniqueDeviceID: string; var LName: JString; begin LName := TJSettings_Secure.JavaClass.ANDROID_ID; Result := JStringToString(TJSettings_Secure.JavaClass.getString(TAndroidHelper.ContentResolver, LName)); end;
-
Firemonkey app for Android - segmantation fault in TIdThreadSafe.Lock
Dave Nottage replied to Vandrovnik's topic in Indy
You would if you included the Indy source path. If the callstack says it's being used, you're using it. Does your app use any tethering functionality? That ultimately includes Indy units. -
I'm assuming he means any file-based media that it can access. This may be of use to you: uses Androidapi.JNI.JavaTypes, Androidapi.JNIBridge, Androidapi.JNI.Os, Androidapi.JNI.GraphicsContentViewText, Androidapi.Helpers; type JStorageManager = interface; JStorageVolume = interface; JStorageManagerClass = interface(JObjectClass) ['{0F83E5E0-9AE5-41F8-9FA1-E91CABBC6720}'] function _GetACTION_MANAGE_STORAGE: JString; cdecl; function _GetEXTRA_REQUESTED_BYTES: JString; cdecl; function _GetEXTRA_UUID: JString; cdecl; function _GetUUID_DEFAULT: JUUID; cdecl; property ACTION_MANAGE_STORAGE: JString read _GetACTION_MANAGE_STORAGE; property EXTRA_REQUESTED_BYTES: JString read _GetEXTRA_REQUESTED_BYTES; property EXTRA_UUID: JString read _GetEXTRA_UUID; property UUID_DEFAULT: JUUID read _GetUUID_DEFAULT; end; [JavaSignature('android/os/storage/StorageManager')] JStorageManager = interface(JObject) ['{A7190FB5-1DBE-4A4E-8A21-A6215C00243C}'] function getAllocatableBytes(storageUuid: JUUID): Int64; cdecl; function getCacheQuotaBytes(storageUuid: JUUID): Int64; cdecl; function getCacheSizeBytes(storageUuid: JUUID): Int64; cdecl; function getMountedObbPath(rawPath: JString): JString; cdecl; function getPrimaryStorageVolume: JStorageVolume; cdecl; function getStorageVolume(&file: JFile): JStorageVolume; cdecl; function getStorageVolumes: JList; cdecl; function getUuidForPath(path: JFile): JUUID; cdecl; function isAllocationSupported(fd: JFileDescriptor): boolean; cdecl; function isCacheBehaviorGroup(path: JFile): boolean; cdecl; function isCacheBehaviorTombstone(path: JFile): boolean; cdecl; function isEncrypted(&file: JFile): boolean; cdecl; function isObbMounted(rawPath: JString): boolean; cdecl; function mountObb(rawPath: JString; key: JString; listener: JOnObbStateChangeListener): boolean; cdecl; // function openProxyFileDescriptor(mode : Integer; callback : JProxyFileDescriptorCallback; handler : JHandler) : JParcelFileDescriptor; cdecl; function unmountObb(rawPath: JString; force: boolean; listener: JOnObbStateChangeListener): boolean; cdecl; procedure allocateBytes(fd: JFileDescriptor; bytes: Int64); cdecl; overload; procedure allocateBytes(storageUuid: JUUID; bytes: Int64); cdecl; overload; procedure setCacheBehaviorGroup(path: JFile; group: boolean); cdecl; procedure setCacheBehaviorTombstone(path: JFile; tombstone: boolean); cdecl; end; TJStorageManager = class(TJavaGenericImport<JStorageManagerClass, JStorageManager>) end; JStorageVolumeClass = interface(JObjectClass) ['{C11D1D2A-77D0-4D1A-B4B9-5042B60BADB0}'] function _GetCREATOR: JParcelable_Creator; cdecl; function _GetEXTRA_STORAGE_VOLUME: JString; cdecl; property CREATOR: JParcelable_Creator read _GetCREATOR; property EXTRA_STORAGE_VOLUME: JString read _GetEXTRA_STORAGE_VOLUME; end; [JavaSignature('android/os/storage/StorageVolume')] JStorageVolume = interface(JObject) ['{F6555252-D4E1-405B-BAAB-2C8F59A01F41}'] function createAccessIntent(directoryName: JString): JIntent; cdecl; function describeContents: Integer; cdecl; function equals(obj: JObject): boolean; cdecl; function getDescription(context: JContext): JString; cdecl; function getState: JString; cdecl; function getUuid: JString; cdecl; function hashCode: Integer; cdecl; function isEmulated: boolean; cdecl; function isPrimary: boolean; cdecl; function isRemovable: boolean; cdecl; function toString: JString; cdecl; procedure writeToParcel(parcel: JParcel; flags: Integer); cdecl; end; TJStorageVolume = class(TJavaGenericImport<JStorageVolumeClass, JStorageVolume>) end; procedure TForm1.Button1Click(Sender: TObject); var LService: JObject; LStorageManager: JStorageManager; LVolumes: JList; LVolume: JStorageVolume; I: Integer; begin LService := TAndroidHelper.Activity.getSystemService(TJContext.JavaClass.STORAGE_SERVICE); LStorageManager := TJStorageManager.Wrap(TAndroidHelper.JObjectToID(LService)); LVolumes := LStorageManager.getStorageVolumes; for I := 0 to LVolumes.size - 1 do begin LVolume := TJStorageVolume.Wrap(LVolumes.get(I)); Memo1.Lines.Add(Format('%s (%s)', [JStringToString(LVolume.getDescription(TAndroidHelper.Context)), JStringToString(LVolume.getUuid)])); end; end;
-
Firemonkey app for Android - segmantation fault in TIdThreadSafe.Lock
Dave Nottage replied to Vandrovnik's topic in Indy
Yes, you are. Easiest way to track down where is to check the units compiled units (.dcu files) -
How to disable automatic adding of units to interface-uses
Dave Nottage replied to microtronx's topic in FMX
Change the ClassGroup property on the service (data) module to System.Classes.TPersistent before adding any components -
Delphi Rio 10.3.3 crashes on big multiline constants.
Dave Nottage replied to vhanla's topic in Delphi IDE and APIs
You should consider compiling the text into the app and loading it as a resource. See here: https://stackoverflow.com/a/8943364/3164070 -
Using Facebook SDK in Firemonkey (iOS and Android)
Dave Nottage replied to MikeMon's topic in Cross-platform
I'm sure there is, since there's been a number of changes in the last 3 years. Check the changelog for v5, for example: https://github.com/facebook/facebook-ios-sdk/blob/master/CHANGELOG.md -
That's just the timer. Battery life will be affected by the settings used with the actual location services, as determined by MonitoringDistance and MonitoringInterval. There's some information here about the best strategies to use: https://developer.android.com/guide/topics/location/strategies
-
[iOS] Current phone device is stored/cached where ? (in XCode, in RadStudio)
Dave Nottage replied to Rollo62's topic in Cross-platform
The ActiveMobileDevice tag in the .dproj.local file has info about connected devices. Whether it retains "old" devices I don't know. -
You don't have Read Call Log and Read Phone Numbers permissions set in the Project Options for Android 64-bit.
-
Linker errors when including Facebook SDK on iOS12
Dave Nottage replied to Hans♫'s topic in Cross-platform
If you're still having trouble, please look at line 175 here: https://github.com/DelphiWorlds/KastriFree/blob/master/API/DW.iOSapi.Firebase.pas Basically forces the linker to link to libclang_rt.ios.a, which has the "missing" symbol -
That is awesome! Great news