blob: 551126630550104360a5c6e3c1fe1d1c9d85650a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
// Copyright (C) 2022 The Qt Company Ltd.
// Copyright (c) 2016, BogDan Vatra <bogdan@kde.org>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
package org.qtproject.qt.android.bindings;
import android.os.Bundle;
import android.content.ComponentName;
import android.content.pm.PackageManager;
public class QtServiceLoader extends QtLoader {
QtService m_service;
QtServiceLoader(QtService service) {
super(service, QtService.class);
m_service = service;
}
public void onCreate() {
try {
m_contextInfo = m_service.getPackageManager().getServiceInfo(new ComponentName(m_service, m_service.getClass()), PackageManager.GET_META_DATA);
} catch (Exception e) {
e.printStackTrace();
m_service.stopSelf();
return;
}
if (QtApplication.m_delegateObject != null && QtApplication.onCreate != null) {
Bundle bundle = null;
QtApplication.invokeDelegateMethod(QtApplication.onCreate, bundle);
}
startApp(true);
}
@Override
protected void finish() {
m_service.stopSelf();
}
@Override
protected String loaderClassName() {
return "org.qtproject.qt.android.QtServiceDelegate";
}
@Override
protected Class<?> contextClassName() {
return android.app.Service.class;
}
}
|