2017-12-10 4 views
-2

私を助けてください。自分のウェブサイト用のAndroidアプリケーションを作成しました。通知を設定するにはどうすればよいですか?

今、自分のウェブサイトに新しいコンテンツを更新/アップロードするときに、ユーザーに通知したいと思います。 は*「...に追加されます...」
*「今すぐチェックアウト:私は、ユーザーが通知を取得し、私のapplicationm USTを使用している人、私のWebページに何かを更新するとき

は、私が言うことを意味します。 .. "

私はあなたが何を言おうとしているのか理解していただければ幸いです。
私の悪い英語のSorrry

私は:ウェブページに新しいニュースを追加する新聞のアプリケーションのように。
ユーザーは「何か起こる」というメッセージを受け取る

+0

seach for 'android rss feed' –

+1

通知は大きなテーマです。あなたはそれについて検索し、それがAndroidアプリケーションのためにどのように実装されているか見る必要があります。次に、特定の質問がある場合は、ここで助けを求めることができます。 –

答えて

0

Firebaseなどのプッシュ通知を行うために何かを使用できます。 ここからリンクを得ることができますhere

+0

おかげで洙ずっと...私はそれを –

+0

[OK]をおかげで私はそれを知っているが、私は、通知に を送信する必要があります。しかし、私は知っているワナたびは、どのような方法があることのために.... だから、通知が自動的に送信... –

1

アプリケーションにFirebaseを追加する最も簡単なソリューションです。

Firebase Cloud Messaging Serviceが必要です。

compile 'com.google.firebase:firebase-messaging:11.6.2' 

あなた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()); 
    } 
    } 
} 

を作成ユーザーまたはあなたのアプリを使用するすべてのユーザー。

+0

を得た –

+0

私はfirebaseアカウントにログインするたびにエンドユーザに通知します。 –

+0

https://stackoverflow.com/questions/37542073/send-notification-automatically-from-firebase –

関連する問題