Android 如何设置通知?
请帮帮我。我为我的网站创建了一个Android应用程序 现在我想在更新/上传新内容到我的网站时通知用户 我的意思是,当我更新我的网页时,使用我的应用程序的用户必须得到以下通知: *“…已添加到…”Android 如何设置通知?,android,webview,feed,Android,Webview,Feed,请帮帮我。我为我的网站创建了一个Android应用程序 现在我想在更新/上传新内容到我的网站时通知用户 我的意思是,当我更新我的网页时,使用我的应用程序的用户必须得到以下通知: *“…已添加到…” *“现在结账…” 我希望你能理解我想说的话。 对不起,我英语不好 例如:就像报纸应用程序一样,在网页上添加新新闻。 用户收到“有事情发生”的通知。您可以使用一些东西来生成推送通知,例如Firebase。 这里有一个链接,您可以从它开始,这是将Firebase添加到应用程序的最简单解决方案 那你就需要
*“现在结账…” 我希望你能理解我想说的话。
对不起,我英语不好 例如:就像报纸应用程序一样,在网页上添加新新闻。
用户收到“有事情发生”的通知。您可以使用一些东西来生成推送通知,例如Firebase。
这里有一个链接,您可以从它开始,这是将Firebase添加到应用程序的最简单解决方案 那你就需要 将此服务添加到您的清单中
<service
android:name=".model.notifications.NotificationService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
如果您转到Firebase仪表板中的“通知”面板,您可以向特定用户或使用您的应用程序的每个用户发送即时通知。seach for
android rss提要
通知是一个重要主题。你需要搜索它,看看它是如何为Android应用程序实现的。如果你有具体的问题,你可以在这里寻求帮助。我知道,但每次我都要发送通知,但我想知道有没有办法。。。。所以通知会自动发送…每次我登录firebase帐户时,都会发送通知给最终用户,对吗。。。
<service
android:name=".model.notifications.NotificationService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
public class NotificationService extends FirebaseMessagingService {
@Override public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
Timber.d("Message received [" + remoteMessage + "]");
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent =
PendingIntent.getActivity(this, 1410, intent, PendingIntent.FLAG_ONE_SHOT);
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this).setSmallIcon(R.drawable.logo)
.setContentTitle("Notification!")
.setContentText(remoteMessage.getNotification().getBody())
.setAutoCancel(true)
.setContentIntent(pendingIntent);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (notificationManager != null) {
notificationManager.notify(1410, notificationBuilder.build());
}
}
}