2017-09-07 62 views
1

私は両方のトークンを必要としています...私はPushNotification Pluginを使用しています...私はそのトークンを返すことを知っています...しかし、私はドキュメントが非常に悪いと思う...私は通知を表示する必要はありません...私はトークンが必要なのです... ONLY IT 誰かが私を救うことができますか?ほんとうに必要だ。アプリデベロッパーで設定が必要ですか? 私はすでにアンドロイドの送信者IDを持っていると私は両方でプラグインを初期化:AppDelegateとMainActivity ヘルプPLEEEAAAAAAASExamarinフォームでアンドロイドとIOSデバイストークンを取得する方法は?

私のクラス、GoogleとAppleの両方がであなたにトークンを送信しますPCL

using PushNotification.Plugin; 
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using Newtonsoft.Json.Linq; 
using PushNotification.Plugin.Abstractions; 

namespace neoFly_Montana 
{ 
public class PushNot : IPushNotificationListener 
{ 
    public void OnError(string message, DeviceType deviceType) 
    { 
     throw new NotImplementedException(); 
    } 

    public void OnMessage(JObject values, DeviceType deviceType) 
    { 
     throw new NotImplementedException(); 
    } 

    public void OnRegistered(string token, DeviceType deviceType) 
    { 
     throw new NotImplementedException(); 
    } 

    public void OnUnregistered(DeviceType deviceType) 
    { 
     throw new NotImplementedException(); 
    } 

    public bool ShouldShowNotification() 
    { 
     throw new NotImplementedException(); 
    } 
} 
} 
+1

ヘイジョイス!私はPushNotificationPluginの使用をお勧めしません。あなたは抽象化から多くを得ることができず、プッシュ通知なしでそれを処理するためのコードを追加するのはかなり簡単です。より良いツールは、Mobile Center Push SDK(https://mobile.azure.com)です。モバイルセンターでは、プッシュ通知の管理が非常に簡単になりました。 –

答えて

1

にデバイスがAPNSまたはGCM/FCMに登録されたら、OnRegisteredメソッドを使用します。

OnRegisteredには、トークンを保存するロジックを追加できます。

public void OnRegistered(string token, DeviceType deviceType) 
{ 
    //use token here 
} 
+0

ええ。私はそれを知っています... 私はラインを使用していますCrossPushNotification.Current.Register();それを呼び出すために...しかし、私はハンドルの例外を持っています...私は原因を知っていません –

+1

それは楽しいことではありません。質問を編集し、エラー/スタックトレースを投稿すると、私は見てみましょう! –

+0

未処理の例外の原因はどこで確認できますか?私の試しキャッチはgettintではありません... –

関連する問題