0
私はXamarinウォークスルーに従っており、それは私のためには機能しません。 コードはこれを正常に処理しますが、通知は送信されません。 エミュレータまたはデバイスに表示されることはありません。Xamarin.Forms Androidローカル通知が送信されない
私は何が起こっているのか分かりません。
public override void OnReceive(Context context, Intent intent)
{
string message = intent.GetStringExtra("message");
string title = intent.GetStringExtra("title");
int id = int.Parse(intent.GetStringExtra("id"));
//Generate a notification with just short text and small icon
NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
.SetAutoCancel(true) // Dismiss from the notif. area when clicked
.SetContentTitle(title) // Set its title
.SetContentText(message); // The message to display.
NotificationManager notificationManager = (NotificationManager)context.GetSystemService(Context.NotificationService);
notificationManager.Notify(id, builder.Build());
ヘルプやリンクは非常に役に立ちます。私はちょうど完全に失われている。これについて約14時間ほど作業しており、Googleでヘルプを見つけることはできません。
私の質問への回答:通知を正しく作成して送信するためのアイコンが必要です。しかし、持っていないというエラーは出ません。
ショートバージョン:通知にアイコンを追加
.SetSmallIcon(Resource.Drawable.icon);
Ah!あなたがアイコンを持っていることが必要です。私はそれについて考えなかった。機能テストだった。 – Hyren123