Created
December 30, 2019 07:17
-
-
Save DelphiWorlds/8eaa900ea9df70df902bee2123a64c6d to your computer and use it in GitHub Desktop.
Delphi equivalent for appSendBroadcast here: https://github.com/SteveCorbett/DelphiAndroidIntents/blob/master/Android/delphiintents/src/main/java/au/com/corbtech/delphiintents/SendIntent.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uses | |
Androidapi.JNI.GraphicsContentViewText, Androidapi.JNI.Os, Androidapi.JNI.JavaTypes, Androidapi.Helpers; | |
procedure SendBroadcast(const AIntent: JIntent); | |
var | |
LResolveInfoList: JList; | |
LResolveInfo: JResolveInfo; | |
LComponentName: JComponentName; | |
LExplicitIntent: JIntent; | |
I: Integer; | |
begin | |
if TJBuild_VERSION.JavaClass.SDK_INT >= 26 then | |
begin | |
LResolveInfoList := TAndroidHelper.Context.getPackageManager.queryBroadcastReceivers(AIntent, 0); | |
for I := 0 to LResolveInfoList.size - 1 do | |
begin | |
LResolveInfo := TJResolveInfo.Wrap(TAndroidHelper.JObjectToID(LResolveInfoList.get(I))); | |
LComponentName := TJComponentName.JavaClass.init(LResolveInfo.activityInfo.applicationInfo.packageName, LResolveInfo.activityInfo.name); | |
LExplicitIntent := TJIntent.JavaClass.init(AIntent); | |
LExplicitIntent.setComponent(LComponentName); | |
TAndroidHelper.Context.sendBroadcast(LExplicitIntent); | |
end; | |
end | |
else | |
TAndroidHelper.Context.sendBroadcast(AIntent); | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment