Плагин 'Pu sh Client' в Gluon Cloud, ссылка не работает - PullRequest
0 голосов
/ 11 марта 2020

Я работаю над мобильным проектом javafx. Я пытаюсь реализовать уведомление pu sh, используя Gluon cloud link s Pu sh Client . Я взял образец приложения под названием Pu sh notes из образцов github repo и попробовал его на своем устройстве. Приложение отлично устанавливается. Он также хранит заметки в глюонном облаке. Но в logcat я вижу эту ошибку.

2020-03-11 15:31:29.283 21232-21258/com.gluonhq.pushnotes W/art: Class com.sun.javafx.fxml.BeanAdapter failed lock verification and will run slower.
2020-03-11 15:31:29.435 21232-21258/com.gluonhq.pushnotes I/System.out: >>>>>> Just before registering...
2020-03-11 15:31:29.438 21232-21258/com.gluonhq.pushnotes E/GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
2020-03-11 15:31:29.440 21232-21258/com.gluonhq.pushnotes W/art: Class com.google.android.gms.common.internal.zzz failed lock verification and will run slower.
2020-03-11 15:31:29.444 21232-21258/com.gluonhq.pushnotes W/art: Class com.google.android.gms.common.zzf failed lock verification and will run slower.
2020-03-11 15:31:29.445 21232-21258/com.gluonhq.pushnotes W/art: Class com.google.android.gms.common.zzd$zzc failed lock verification and will run slower.
2020-03-11 15:31:29.453 21232-21258/com.gluonhq.pushnotes W/System.err: java.lang.IllegalArgumentException: No such service ComponentInfo{com.gluonhq.pushnotes/com.gluonhq.impl.charm.down.plugins.android.PushNotificationJobService}
2020-03-11 15:31:29.453 21232-21258/com.gluonhq.pushnotes W/System.err:     at android.os.Parcel.readException(Parcel.java:1688)
2020-03-11 15:31:29.453 21232-21258/com.gluonhq.pushnotes W/System.err:     at android.os.Parcel.readException(Parcel.java:1637)
2020-03-11 15:31:29.453 21232-21258/com.gluonhq.pushnotes W/System.err:     at android.app.job.IJobScheduler$Stub$Proxy.schedule(IJobScheduler.java:158)
2020-03-11 15:31:29.453 21232-21258/com.gluonhq.pushnotes W/System.err:     at android.app.JobSchedulerImpl.schedule(JobSchedulerImpl.java:42)
2020-03-11 15:31:29.453 21232-21258/com.gluonhq.pushnotes W/System.err:     at com.gluonhq.charm.down.plugins.android.AndroidPushNotificationsService.register(AndroidPushNotificationsService.java:88)
2020-03-11 15:31:29.453 21232-21258/com.gluonhq.pushnotes W/System.err:     at com.gluonhq.cloudlink.client.push.PushClient.enable(PushClient.java:78)
2020-03-11 15:31:29.453 21232-21258/com.gluonhq.pushnotes W/System.err:     at com.gluonhq.pushnotes.PushNotes.postInit(PushNotes.java:57)
2020-03-11 15:31:29.454 21232-21258/com.gluonhq.pushnotes W/System.err:     at com.gluonhq.charm.glisten.application.MobileApplication.a(SourceFile:272)
2020-03-11 15:31:29.454 21232-21258/com.gluonhq.pushnotes W/System.err:     at com.gluonhq.charm.glisten.application.MobileApplication.start(SourceFile:233)
2020-03-11 15:31:29.454 21232-21258/com.gluonhq.pushnotes W/System.err:     at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
2020-03-11 15:31:29.454 21232-21258/com.gluonhq.pushnotes W/System.err:     at com.sun.javafx.application.LauncherImpl.access$lambda$8(LauncherImpl.java)
2020-03-11 15:31:29.454 21232-21258/com.gluonhq.pushnotes W/System.err:     at com.sun.javafx.application.LauncherImpl$$Lambda$9.run(Unknown Source)
2020-03-11 15:31:29.454 21232-21258/com.gluonhq.pushnotes W/System.err:     at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
2020-03-11 15:31:29.454 21232-21258/com.gluonhq.pushnotes W/System.err:     at com.sun.javafx.application.PlatformImpl.access$lambda$6(PlatformImpl.java)
2020-03-11 15:31:29.454 21232-21258/com.gluonhq.pushnotes W/System.err:     at com.sun.javafx.application.PlatformImpl$$Lambda$7.run(Unknown Source)
2020-03-11 15:31:29.454 21232-21258/com.gluonhq.pushnotes W/System.err:     at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
2020-03-11 15:31:29.454 21232-21258/com.gluonhq.pushnotes W/System.err:     at com.sun.javafx.application.PlatformImpl.access$lambda$18(PlatformImpl.java)
2020-03-11 15:31:29.454 21232-21258/com.gluonhq.pushnotes W/System.err:     at com.sun.javafx.application.PlatformImpl$$Lambda$19.run(Unknown Source)
2020-03-11 15:31:29.454 21232-21258/com.gluonhq.pushnotes W/System.err:     at java.security.AccessController.doPrivileged(AccessController.java:57)
2020-03-11 15:31:29.454 21232-21258/com.gluonhq.pushnotes W/System.err:     at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
2020-03-11 15:31:29.454 21232-21258/com.gluonhq.pushnotes W/System.err:     at com.sun.javafx.application.PlatformImpl.access$lambda$5(PlatformImpl.java)
2020-03-11 15:31:29.454 21232-21258/com.gluonhq.pushnotes W/System.err:     at com.sun.javafx.application.PlatformImpl$$Lambda$6.run(Unknown Source)
2020-03-11 15:31:29.454 21232-21258/com.gluonhq.pushnotes W/System.err:     at com.sun.glass.ui.monocle.RunnableProcessor.runLoop(RunnableProcessor.java:93)
2020-03-11 15:31:29.454 21232-21258/com.gluonhq.pushnotes W/System.err:     at com.sun.glass.ui.monocle.RunnableProcessor.run(RunnableProcessor.java:52)
2020-03-11 15:31:29.454 21232-21258/com.gluonhq.pushnotes W/System.err:     at java.lang.Thread.run(Thread.java:761)

Ниже приведен основной класс ...

/**
 * Copyright (c) 2016, 2017 Gluon
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 *     * Neither the name of Gluon, any associated website, nor the
 * names of its contributors may be used to endorse or promote products
 * derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL GLUON BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package com.gluonhq.pushnotes;

import com.gluonhq.charm.glisten.application.MobileApplication;
import com.gluonhq.charm.glisten.visual.Swatch;
import com.gluonhq.cloudlink.client.push.PushClient;
import com.gluonhq.pushnotes.views.AppViewManager;

import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;

public class PushNotes extends MobileApplication {

    public static final String POPUP_FILTER_NOTES = "Filter Notes";
    private static final String FIREBASE_SENDER_ID = "609XXXXXXX";

    @Override
    public void init() {
        AppViewManager.registerViewsAndDrawer(this);
    }

    @Override
    public void postInit(Scene scene) {
        Swatch.LIGHT_GREEN.assignTo(scene);

        scene.getStylesheets().add(PushNotes.class.getResource("style.css").toExternalForm());
        ((Stage) scene.getWindow()).getIcons().add(new Image(PushNotes.class.getResourceAsStream("/icon.png")));

        PushClient pushClient = new PushClient();
        System.out.println(">>>>>> Just before registering...");
        pushClient.enable(FIREBASE_SENDER_ID);
        System.out.println(">>>>>> Just after registering...");
    }
}

Как вы можете видеть, непосредственно перед вызовом 'pushClient. enable (FIREBASE_SENDER_ID) ' все работает отлично. При вызове метода выдается java .lang.IllegalArgumentException, говорящее, что «PushNotificationJobService» не найден.

Ниже приведены gradle и manifest. build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'org.javafxports:jfxmobile-plugin:1.3.17'
    }
}

apply plugin: 'org.javafxports.jfxmobile'

repositories {
    jcenter()
    maven {
        url 'https://nexus.gluonhq.com/nexus/content/repositories/releases'
    }
}

mainClassName = 'com.gluonhq.pushnotes.PushNotes'

dependencies {
    compile 'com.gluonhq:glisten-afterburner:1.4.1'
    compile 'com.gluonhq:charm-cloudlink-client:4.5.2'
}

jfxmobile {
    downConfig {
        version = '3.8.6'
        // Do not edit the line below. Use Gluon Mobile Settings in your project context menu instead
        plugins 'device', 'display', 'lifecycle', 'push-notifications', 'runtime-args', 'statusbar', 'storage'
    }
    android {
        manifest = 'src/android/AndroidManifest.xml'
    }
    ios {
        infoPList = file('src/ios/Default-Info.plist')
        forceLinkClasses = [
                'com.gluonhq.pushnotes.**.*',
                'com.gluonhq.**.*',
                'javax.annotations.**.*',
                'javax.inject.**.*',
                'javax.json.**.*',
                'org.glassfish.json.**.*'
        ]
    }
}

AndroidManifest. xml

<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.gluonhq.pushnotes" android:versionCode="1" android:versionName="1.0">
        <supports-screens android:xlargeScreens="true"/>
        <permission android:name="com.gluonhq.pushnotes.permission.C2D_MESSAGE" android:protectionLevel="signature" />
        <uses-permission android:name="com.gluonhq.pushnotes.C2D_MESSAGE" />
        <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
        <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"/>
        <uses-permission android:name="android.permission.WAKE_LOCK"/>
        <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="28"/>
        <application android:label="pushnotes" android:name="android.support.multidex.MultiDexApplication" android:icon="@mipmap/ic_launcher">
                <meta-data android:name="com.google.android.gms.version" android:value="9452000"/>
                <activity android:name="javafxports.android.FXActivity" 
                          android:label="pushnotes" 
                          android:launchMode="singleTop"
                          android:configChanges="orientation|screenSize">
                        <meta-data android:name="main.class" android:value="com.gluonhq.pushnotes.PushNotes"/>
                        <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>
                <receiver
                    android:name="com.google.android.gms.gcm.GcmReceiver"
                    android:exported="true"
                    android:permission="com.google.android.c2dm.permission.SEND" >
                    <intent-filter>
                        <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                        <category android:name="com.gluonhq.pushnotes" />
                    </intent-filter>
                </receiver>
                <service
                    android:name="com.gluonhq.impl.charm.down.plugins.android.PushGcmListenerService"
                    android:exported="false" >
                    <intent-filter>
                        <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                    </intent-filter>
                </service>
                <service
                    android:name="com.gluonhq.impl.charm.down.plugins.android.PushInstanceIDListenerService"
                    android:exported="false">
                    <intent-filter>
                        <action android:name="com.google.android.gms.iid.InstanceID" />
                    </intent-filter>
                </service>
                <service 
                    android:name="com.gluonhq.impl.charm.down.plugins.android.RegistrationIntentService"
                    android:exported="false" >
                </service>

                <activity android:name="com.gluonhq.impl.charm.down.plugins.android.PushNotificationActivity"
                        android:parentActivityName="javafxports.android.FXActivity">
                    <meta-data android:name="android.support.PARENT_ACTIVITY"
                               android:value="javafxports.android.FXActivity"/>
                </activity>
                <activity android:name="com.gluonhq.impl.charm.down.plugins.android.PermissionRequestActivity" />
        </application>
</manifest>

Я не сильно изменился в двух файлах выше. Я что-то пропустил? Как мне заставить это работать?

И что означает «Идентификатор» в «форме уведомления pu sh» на глюонной приборной панели (изображение ниже). Это поле отсутствует в официальной документации по глюону. Pu sh форма уведомления в глюонной панели приборов

...