Hirdetés

Új hozzászólás Aktív témák

  • doc

    nagyúr

    Sziasztok!

    Szeretnek egy Android appot, ami tud ketfele notificationt kuldeni:
    - uj uzenet
    - nem fogadott hivas
    Odaig eljutottam hogy van az app, benne ket gombbal amik a ket fenti notificationt tudjak ki/be kapcsolgatni (megjeleniteni es torolni). A problemam az, hogy az istennek sem hajlando felismerni a rendszer (pontosabban egy bizonyos masik app, a Rideology) mint new message/missed call notificationok.

    Jelenleg ket otletem van:
    - valami hianyzik, es a notificationokhoz kell meg valami hogy "igazi" missed call es new message ertesitesek legyenek
    - nem is a notification a lenyeg, hanem valamilyen event mikor megerkezik az uzenet/hivas. Ezt mondjuk annyibol ketlem hogy a Rideology siman mutat pl 'uj uzenet' ertesitest ha az indulasakor van ilyen, ezert gondoltam hogy a notificationoket figyeli, de lehet hogy van valami rendszerszintu flag ezekre amirol nem tudok :-/

    valakinek esetleg tippje, hogy mit probaljak meg?

    peldanak itt a 'new message' notification kodja:

    private fun showIncomingMessageNotification() {
        // Create the notification channel (if not already created)
        createNotificationChannel()

        val intent = Intent(this, MainActivity::class.java)
        intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
        val pendingIntent = PendingIntent.getActivity(this, 0, intent, 0)

        val notificationBuilder = NotificationCompat.Builder(this, CHANNEL_ID)
            .setSmallIcon(R.drawable.ic_message)
            .setContentTitle("Messenger")
            .setContentText("Jane Doe")
            .setPriority(NotificationCompat.PRIORITY_HIGH)
            .setCategory(NotificationCompat.CATEGORY_MESSAGE)
            .setContentIntent(pendingIntent)
            .setAutoCancel(true)

        notificationManager?.notify(
            INCOMING_MESSAGE_NOTIFICATION_ID,
            notificationBuilder.build()
        )
    }

Új hozzászólás Aktív témák