gluon Mobile LocalNotificationsServices.class Not working

拥有回忆 提交于 2019-12-06 06:02:10

Besides the call to the service in your code, the Charm Down plugin for local notifications requires some additional configuration, as you can read in the documentation you have linked.

In your AndroidManifest file you are missing a few things:

  • Use a SingleTop launch mode
  • Add the NotificationActivity
  • Add the AlarmReceiver

Like this:

<manifest ...>
...
<application ...>
  <activity android:name="javafxports.android.FXActivity"
            android:label="Sample"
            android:launchMode="singleTop"
            android:configChanges="orientation|screenSize">
    <meta-data android:name="main.class" android:value="com.sample.Main"/>
    ...
  </activity>
  ...
  <activity android:name="com.gluonhq.impl.charm.down.plugins.android.NotificationActivity"
            android:parentActivityName="javafxports.android.FXActivity">
        <meta-data android:name="android.support.PARENT_ACTIVITY" 
                   android:value="javafxports.android.FXActivity"/>
  </activity>
  <receiver android:name="com.gluonhq.impl.charm.down.plugins.android.AlarmReceiver" />
</application>

As you can see, the plugin hides from you the Android implementation, so you don't need to use Android APIs. The same goes for iOS. So far, all you need to do is take care of updating your manifest.

make changes in this code as you want , hope this will help you

NotificationCompat.Builder builder=new NotificationCompat.Builder(this);
    builder.setSmallIcon(R.drawable.ic);
    builder.setContentTitle("NewsClient");
    builder.setContentText("NewsClient is Running");
    int mll=001;
    NotificationManager mNotification=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
    mNotification.notify(mll,builder.build());
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!