1.x.x
Documentation for the Unreal C++ Plugin
Loading...
Searching...
No Matches
ApexSDKAndroid_UPL.xml
Go to the documentation of this file.
1
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
2
3
<
root
xmlns:android
=
"http://schemas.android.com/apk/res/android"
>
4
<
init
>
5
<
log
text
=
"PixoLauncherAndroid init"
/>
6
<
setStringFromProperty
result
=
"HostString"
ini
=
"Engine"
section
=
"/Script/AndroidRuntimeSettings.AndroidRuntimeSettings"
property
=
"PackageName"
default
=
"com.pixovr.blank"
/>
7
<
log
text
=
"$S(HostString)"
/>
8
</
init
>
9
10
<
prebuildCopies
>
11
<
log
text
=
"Copying all the Java files."
/>
12
<
copyDir
src
=
"$S(PluginDir)/Java"
dst
=
"$S(BuildDir)"
/>
13
</
prebuildCopies
>
14
15
<
proguardAdditions
>
16
<
insert
>
17
</
insert
>
18
</
proguardAdditions
>
19
20
<
resourceCopies
>
21
</
resourceCopies
>
22
23
<
androidManifestUpdates
>
24
<
addAttribute
tag
=
"application"
name
=
"android:requestLegacyExternalStorage"
value
=
"true"
/>
25
<
addPermission
android:name
=
"android.permission.MANAGE_EXTERNAL_STORAGE"
/>
26
<
addPermission
android:name
=
"android.permission.READ_PRIVILEGED_PHONE_STATE"
/>
27
<
addPermission
android:name
=
"android.permission.READ_PHONE_STATE"
/>
28
<
addPermission
android:name
=
"android.permission.ACCESS_WIFI_STATE"
/>
29
<
addPermission
android:name
=
"android.permission.QUERY_ALL_PACKAGES"
/>
30
<
addElements
tag
=
"application"
>
31
</
addElements
>
32
<
addAttribute
tag
=
"application"
name
=
"android:sharedUserId"
value
=
"android.uid.system"
/>
33
34
<
loopElements
tag
=
"activity"
>
35
<
setStringFromAttribute
result
=
"activityName"
tag
=
"$"
name
=
"android:name"
/>
36
<
setBoolIsEqual
result
=
"bGameActivity"
arg1
=
"$S(activityName)"
arg2
=
"com.epicgames.unreal.GameActivity"
/>
37
<
if
condition
=
"bGameActivity"
>
38
<
true
>
39
<
setElement
result
=
"DataElement"
value
=
"data"
/>
40
<
addAttribute
tag
=
"$DataElement"
name
=
"android:scheme"
value
=
"pixovr"
/>
41
<
addAttribute
tag
=
"$DataElement"
name
=
"android:host"
value
=
"$S(HostString)"
/>
42
<
setElement
result
=
"IntentFilter"
value
=
"intent-filter"
/>
43
<
addElements
tag
=
"$IntentFilter"
>
44
<
action
android:name
=
"android.intent.action.VIEW"
/>
45
<
category
android:name
=
"android.intent.category.DEFAULT"
/>
46
<
category
android:name
=
"android.intent.category.BROWSABLE"
/>
47
</
addElements
>
48
<
addElement
tag
=
"$IntentFilter"
name
=
"DataElement"
/>
49
<
addElement
tag
=
"$"
name
=
"IntentFilter"
/>
50
</
true
>
51
</
if
>
52
</
loopElements
>
53
<
replace
find
=
"[HostString]"
with
=
"$S(HostString)"
/>
54
55
</
androidManifestUpdates
>
56
57
<
gameActivityImportAdditions
>
58
<
insert
>
59
import
com.managexr.getserialsample.
*;
60
import
com.Pixo.PixoPlatform.
*;
61
import
android.util.Log
;
62
import
android.Manifest.permission
;
63
import
android.net.wifi.WifiManager
;
64
import
android.net.wifi.WifiInfo
;
65
import
java.net.NetworkInterface
;
66
</
insert
>
67
</
gameActivityImportAdditions
>
68
69
<
gameActivityClassAdditions
>
70
<
insert
>
71
private
final
static
String
TAG
=
"ApexSDKAndroid: "
;
72
private
String
SerialNumber
=
""
;
73
74
public
boolean
AndroidThunkJava_Launch
(
String
packageName
,
String
extraKey
,
String
extraValue
)
75
{
76
Log.debug
(
TAG
+
" AndroidThunkJava_Launch"
);
77
Intent
intent
;
78
String
intentAction
=
""
;
79
String
intentComponent
=
""
;
80
81
int
intentActionIndex
=
packageName.indexOf
(
":"
);
82
if
(
intentActionIndex
>= 0)
83
{
84
intentAction
=
packageName.substring
(
intentActionIndex
+ 1);
85
packageName
=
packageName.substring
(0,
intentActionIndex
);
86
87
intentActionIndex
=
intentAction.indexOf
(
":"
);
88
if
(
intentActionIndex
>= 0)
89
{
90
intentComponent
=
intentAction.substring
(
intentActionIndex
+ 1);
91
intentAction
=
intentAction.substring
(0,
intentActionIndex
);
92
}
93
}
94
95
if
(!
AndroidThunkJava_IsPackageInstalled
(
packageName
))
96
{
97
return
false
;
98
}
99
100
if
(
intentAction.equals
(
""
))
101
{
102
Log.debug
(
TAG
+
"Does not have intent!"
);
103
104
intent
=
getPackageManager
().
getLaunchIntentForPackage
(
packageName
);
105
if
(
intent
==
null
)
106
{
107
return
false
;
108
}
109
}
110
else
111
{
112
Log.debug
(
TAG
+
"Has intent!"
);
113
intent
=
new
Intent
(
intentAction
);
114
if
(
intent
==
null
)
115
{
116
return
false
;
117
}
118
intent.setPackage
(
packageName
);
119
intent.setFlags
(
Intent.FLAG_ACTIVITY_NEW_TASK
);
120
}
121
122
if
(!
extraKey.equals
(
""
))
123
{
124
Log.debug
(
TAG
+
extraKey
+
" - "
+
extraValue
);
125
intent.putExtra
(
extraKey
,
extraValue
);
126
}
127
128
if
(!
intentComponent.equals
(
""
))
129
{
130
intent.setComponent
(
new
android.content.ComponentName
(
packageName
,
intentComponent
));
131
}
132
133
if
(
intent.resolveActivity
(
getPackageManager
()) !=
null
)
134
{
135
startActivity
(
intent
);
136
AndroidThunkJava_ForceQuit
();
137
return
true
;
138
}
139
140
return
false
;
141
}
142
143
public
String
AndroidThunkJava_GetApplicationExtra
(
String
InExtraName
)
144
{
145
Log.debug
(
TAG
+
"AndroidThunkJava_GetApplicationExtra: "
+
InExtraName
);
146
Intent
AppIntent
=
getIntent
();
147
Bundle
AppExtras
=
AppIntent.getExtras
();
148
149
String
ExtraString
=
""
;
150
151
if
(
AppExtras
!=
null
)
152
{
153
Log.debug
(
TAG
+
"Getting extras."
);
154
ExtraString
=
AppExtras.getString
(
InExtraName
);
155
Log.debug
(
TAG
+
"Got extra as: "
+
ExtraString
);
156
}
157
158
return
ExtraString
;
159
}
160
161
public
String
AndroidThunkJava_GetDeviceSerialNumber
()
162
{
163
Log.error
(
"GAOCA: Getting device serial number."
);
164
return
SerialNumber
;
165
}
166
167
public
String
AndroidThunkJava_GetMacAddress
()
168
{
169
Log.error
(
"GAOCA: Getting mac address."
);
170
return
PixoUtilities.getMacAddress
();
171
}
172
</
insert
>
173
</
gameActivityClassAdditions
>
174
175
<
gameActivityOnPauseAdditions
>
176
<
insert
>
177
</
insert
>
178
</
gameActivityOnPauseAdditions
>
179
180
<
gameActivityOnResumeAdditions
>
181
<
insert
>
182
</
insert
>
183
</
gameActivityOnResumeAdditions
>
184
185
<
gameActivityOnCreateAdditions
>
186
<
insert
>
187
188
if
(
PermissionHelper.checkPermission
(
"android.permission.QUERY_ALL_PACKAGES"
) ==
false
) {
189
String
[]
permissions
= {
"android.permission.QUERY_ALL_PACKAGES"
};
190
PermissionHelper.acquirePermissions
(
permissions
);
191
Log.debug
(
"GAOCA: Acquired query all packages permission."
);
192
}
193
194
if
(
PermissionHelper.checkPermission
(
"android.permission.ACCESS_WIFI_STATE"
) ==
false
) {
195
String
[]
permissions
= {
"android.permission.ACCESS_WIFI_STATE"
};
196
PermissionHelper.acquirePermissions
(
permissions
);
197
Log.debug
(
"GAOCA: Acquired access wifi state permission."
);
198
}
199
200
MXRAdminAppMessenger
mxrAdminAppMessenger
=
new
MXRAdminAppMessenger
(
this
);
201
mxrAdminAppMessenger.onSerialUpdated
((
serial
)->{
202
Log.error
(
"GAOCA: SN# - "
+
serial
);
203
SerialNumber
=
serial
;
204
});
205
206
Log.error
(
"GAOCA: Post acquired permission."
);
207
Log.debug
(
"GAOCA: "
+
AndroidThunkJava_GetMacAddress
());
208
</
insert
>
209
</
gameActivityOnCreateAdditions
>
210
211
<
gameActivityOnActivityResultAdditions
>
212
<
insert
>
213
</
insert
>
214
</
gameActivityOnActivityResultAdditions
>
215
216
<
buildGradleAdditions
>
217
<
insert
>
218
android
{
219
compileOptions
{
220
sourceCompatibility
JavaVersion.VERSION_1_8
221
targetCompatibility
JavaVersion.VERSION_1_8
222
}
223
}
224
225
dependencies
{
226
implementation
'org.apache.commons:commons-lang3:3.0'
227
}
228
</
insert
>
229
</
buildGradleAdditions
>
230
</
root
>
ApexSDKAndroid_UPL.xml
Generated
Thu Aug 29 2024 03:26:51
by Doxygen version
1.10.0