receive Push Notification in Background

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • receive Push Notification in Background

    Hallo Leute,
    ich habe ein kleines Problem mit meinen Push Notifications.

    Quellcode

    1. - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo

    Diese Methode wird ja erst aufgerufen wenn man im Banner die Push Notification an klickt.
    Ich benötige aber eine Methode die aufgerufen wird wenn der Banner auftaucht also wenn die App im Hintergrund ist.
    Dafür denke ich mal das ich diese Methode brauche

    Quellcode

    1. - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^(UIBackgroundFetchResult))completionHandler

    In meiner Plist schaut von den Background Mode Einstellungen so aus

    Quellcode

    1. <key>UIBackgroundModes</key>
    2. <array>
    3. <string>remote-notification</string>
    4. </array>


    leider wird diese Methode auch nicht aufgerufen.

    Ich bedanke mich schon einmal im voraus für die Hilfe.
    Marius
  • Marius Hartig schrieb:

    Hmm also ich will einen TableView mit allen Push Notifications haben als Übersicht eigentlich haben sowas viele Apps oder ?
    ^^


    Wie meinst du das? Eine Art History? wie z.B. "X hat eine Nachricht gesendet" "X hat Bild hochgeladen"?

    Das würde ich nicht anhand der Push Notifications ausmachen, sondern die History auf dem Server speichern und diese dann bei Bedarf abrufen.
    Push Notifications können auch verzögert ankommen oder so.

    Sobald du eine Notification bekommst, wurde ja ein bestimmtes Event auf dem Server veranlasst. Speicher da einfach deine History
    Every language has an optimization operator. In ObjC that operator is ‘//’.

    golbros.de
  • Fortrackz schrieb:

    Marius Hartig schrieb:

    Hmm also ich will einen TableView mit allen Push Notifications haben als Übersicht eigentlich haben sowas viele Apps oder ?
    ^^


    Wie meinst du das? Eine Art History? wie z.B. "X hat eine Nachricht gesendet" "X hat Bild hochgeladen"?

    Das würde ich nicht anhand der Push Notifications ausmachen, sondern die History auf dem Server speichern und diese dann bei Bedarf abrufen.
    Push Notifications können auch verzögert ankommen oder so.

    Sobald du eine Notification bekommst, wurde ja ein bestimmtes Event auf dem Server veranlasst. Speicher da einfach deine History


    Jo, wird wohl die einzige Möglichkeit sein.
    Schade, bei Android kann ich alle eingegangen Notifications abrufen, auch wenn die App nicht über die Notification geöffnet wurde.
  • das gleiche Problem habe ich im Moment auch.
    Wenn eine Remote Notification im System aufschlägt, wird wohl die App nicht benachrichtigt (wie bei Android), sondern erst, wenn der User die Notification anklickt/öffnet. Ich hab es aber bisher noch nicht getestet, nur Doku etc gelesen.

    D.h. also wenn man z.B. 3 Push Nachrichten (mit custom Payloads) erhalten hat, man im Notification im Notification Center eine Notification anklickt, bekommt die App auch nur die Payload Daten aus dieser Notification?
    Es gibt also keine Möglichkeit, die Payload Daten auszulesen, wenn die Notification im System ankommt (App ist im Background oder ganz aus dem Speicher)?
    Knowing is not enough, we must apply.
    Willing is not enough, we must do.
  • Wird mit den Silent Push die App auch benachrichtigt, wenn sie komplett geschlossen ist 9also nicht im Speicher/Background)? Oder wirklich nur wenn sie sich im Background befindet? ?(

    -- EDIT

    Spoiler anzeigen
    Use this method to process incoming remote notifications for your app. Unlike the application:didReceiveRemoteNotification: method, which is called only when your app is running in the foreground, the system calls this method when your app is running in the foreground or background. In addition, if you enabled the remote notifications background mode, the system launches your app (or wakes it from the suspended state) and puts it in the background state when a push notification arrives. However, the system does not automatically launch your app if the user has force-quit it. In that situation, the user must relaunch your app or restart the device before the system attempts to launch your app automatically again.


    Also geht das wirklich nur wenn die App im Hintergund läuft.
    Somit muss eigentlich alles Push wirklich serverseitig gemanaged werden^^


    -- EDIT2
    Geht die Zitat Funktion nicht?
    Knowing is not enough, we must apply.
    Willing is not enough, we must do.

    Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von marceo ()