Launch a JavaFX application from a service using JavaFXPorts

£可爱£侵袭症+ 提交于 2019-12-11 17:53:55

问题


I am trying to write an alarm clock application using JavaFXPorts and the org.javafxports.jfxmobile plugin. Beside the main view, which is a JavaFX Application, where the alarm events are set to run later. I need to load another view (another javaFx Application), which is the alarm event it self. This alarm view should be fired from a service which starts at boot time.

I have tried to do so by creating a BroadcastReciver and a Service but unfortunately I can't figure how to add another activity, which is the JavaFX Application that will be fired from the service, to the android manifest.

Currently my manifest looks like this:

    <?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="io.rainrobot.wake.android" android:versionCode="1" android:versionName="1.0">
        <supports-screens android:xlargeScreens="true"/>
        <uses-permission android:name="android.permission.INTERNET"/>
        <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

        <!-- Adding the permission -->
        <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

        <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="27"/>

        <application android:label="wake" android:name="android.support.multidex.MultiDexApplication" android:icon="@mipmap/ic_launcher">
            <activity android:name="io.rainrobot.wake.android.Main" android:label="Main" android:configChanges="orientation|screenSize">
                        <meta-data android:name="main.class" android:value="io.rainrobot.wake.android.Main"/>
                        <meta-data android:name="debug.port" android:value="0"/>
                        <intent-filter>
                                <action android:name="android.intent.action.MAIN"/>
                                <category android:name="android.intent.category.LAUNCHER"/>
                        </intent-filter>
            </activity>

            <activity android:name="???" android:label="Alarm event">
                        ???
                        ???
                        ???
            </activity>


            <!-- Declaring broadcast receiver for BOOT_COMPLETED event. --> 
            <receiver android:name=".Boot" android:enabled="true" android:exported="false">
                <intent-filter>
                    <action android:name="android.intent.action.BOOT_COMPLETED"/>
                </intent-filter>
            </receiver>

            <service    android:name=".Service" android:exported="false">
            </service>
        </application>       
</manifest>

来源:https://stackoverflow.com/questions/51867360/launch-a-javafx-application-from-a-service-using-javafxports

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!