Push Sharp ( https://github.com/Redth/PushSharp )を使用してモノドロイドアプリケーションにプッシュ通知を実装した人はいますか?
このソリューションを使用したいのですが、まだテストを実行できていません。
誰でもこれを行う方法についてのチュートリアルを作成できますか?
ありがとう
Push Sharp ( https://github.com/Redth/PushSharp )を使用してモノドロイドアプリケーションにプッシュ通知を実装した人はいますか?
このソリューションを使用したいのですが、まだテストを実行できていません。
誰でもこれを行う方法についてのチュートリアルを作成できますか?
ありがとう
私は PushSharp の作成者です。
GCM は非常にうまく機能しており、非常に簡単に起動して実行できます。
Google API のプロジェクトをセットアップするには、次のガイドに従ってください: https://github.com/Redth/PushSharp/wiki/How-to-Configure-&-Send-GCM-Google-Cloud-Messaging-Push-Notifications-using -プッシュシャープ
@SpiritMachine が述べたように、Mono For Android アプリケーションに Client Sample を使用できます。(前述のように) 単純にプロジェクトを取得し、好みに合わせて微調整するのが最も簡単な場合があります。 https://github.com/Redth/PushSharp/tree/master/Client.Samples/PushSharp.ClientSample.MonoForAndroid/PushSharp.ClientSample.MonoForAndroid.Gcm
最後に、サーバーから PushSharp を使用して GCM 通知を送信するのは非常に簡単です。
//Create a new instance of PushService
PushService push = new PushService();
//Configure and start Android GCM
//IMPORTANT: The SENDER_ID is your Google API Console App Project ID.
// Be sure to get the right Project ID from your Google APIs Console.
// It's not the named project ID that appears in the Overview,
// but instead the numeric project id in the url:
// eg: https://code.google.com/apis/console/?pli=1#project:785671162406:overview
// where 785671162406 is the project id, which is the SENDER_ID to use!
push.StartGoogleCloudMessagingPushService(
new GcmPushChannelSettings("785671162406", "AIzaSyC2PZNXQDVaUpZGmtsF_Vp8tHtIABVjazI", "com.pushsharp.test"));
//Fluent construction of an Android GCM Notification
//IMPORTANT: For Android you MUST use your own RegistrationId here
// that gets generated within your Android app itself!
push.QueueNotification(NotificationFactory.AndroidGcm()
.ForDeviceRegistrationId("<YOUR_REGISTRATION_ID_HERE>")
.WithCollapseKey("NONE")
.WithJson("{\"alert\":\"Alert Text!\",\"badge\":\"7\"}"));
//Stop the server if you have nothing else to send for a long time
// and tell it to process the remaining queue before exiting!
push.StopAllServices(true);
もちろん、PushSharp は NuGet でも利用できます。
幸運を!
GCM は間違いなく Android でうまく動作します。
PushSharp サーバー アプリケーションは、複数のモバイル OS 実装にわたって非常に優れた機能と管理を提供しているように見えます。
ただし、より最小限の機能で GCM API にアクセスすることだけを実際に検討している場合は、すぐに起動して実行できます。
この gemを使用して、Ruby で独自の必要最小限のサーバーを作成しました。これは、デバイスの登録/登録解除を許可し、メッセージを投稿するための HTTP URL を提供する Sinatra アプリケーションです。私は約30LOCでそれをしました。冗談抜き。Herokuで動いています。
次に、PushSharp リポジトリから MonoDroid クライアントの例を取得し、API に登録/登録解除するようにカスタマイズし、それ以外の場合は、ニーズに合わせて挟み込みました。
ただし、最初に、Google API を使用してプロジェクトを作成し、GCM を有効にする必要があります。ここから始めることができます。