Android Question [SOLVED] Android PUSH notification

Discussion in 'Android Questions' started by SlashIT, Aug 10, 2015.

  1. SlashIT

    SlashIT Member Licensed User

    Hi,

    I have problems with the reception of push notifications ... I get only a simple message toastmessage and only when the device is turned on.

    Why ??

    I followed this tutorial and tried different systems of sending the message to the server Google, but the result is always the same: toastmessage (only when the device is turned on).

    So I followed the advice of google and install the APP "Push Notification Tester" (free on google play) and everything works perfectly !! Notifications when the device is off; notifications when the app is not running ... why ??

    Do you know why? someone has already solved?

    Thanks
     
  2. DonManfred

    DonManfred Expert Licensed User

    Question over questions but NO ONE LINE of code? Did you expect to get a solution from us without showing us your code?
     
  3. SlashIT

    SlashIT Member Licensed User

    but why not READ POST before replying !! the code is the same as the link of the tutorial (hover your mouse over 'tutorial') ... let us not waste time if you do not know the answer (with USELESS answers)
     
  4. DonManfred

    DonManfred Expert Licensed User

    I used the same example and it worked (and works) for me
     
  5. SlashIT

    SlashIT Member Licensed User

    thank you. mmm, very strange, I can register the device on the server google and get the id, transmit, always using the google servers, the push. The various devices and versions of OS use various methods to display the push? This would explain why I see a simple TOASTmessage. I am using a Nexus S and a galaxy tab gt-p3110
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Where does the toast message come from? It probably comes from your service code.
     
  7. SlashIT

    SlashIT Member Licensed User

    Hi Erel,
    I did some testing and this is the situation: i receive the push only when the application started, and not leave the device in standby; if I kill the APP (not close, kill), when I receive the push, the device reopens the App and always shows the toastmsg. I'm doing something wrong in the manifest example of the tutorial?
    Manifest:
    Code:
    AddManifestText(
    <uses-sdk android:minSdkVersion=
    "4" android:targetSdkVersion="14"/>
    <supports-screens android:largeScreens=
    "true" 
      android:normalScreens=
    "true" 
      android:smallScreens=
    "true" 
      android:anyDensity=
    "true"/>)
    SetApplicationAttribute(android:icon, 
    "@drawable/icon")
    SetApplicationAttribute(android:
    label"$LABEL$")
    'End of default text.

    'C2DM Permissions
    AddManifestText(<permission android:name="$PACKAGE$.permission.C2D_MESSAGE" android:protectionLevel="signature" />)
    AddPermission($PACKAGE$.permission.C2D_MESSAGE)
    AddPermission(com.google.android.c2dm.permission.RECEIVE)
    ' Push Service Receiver Attribute
    SetReceiverAttribute(PushService, android:permission, "com.google.android.c2dm.permission.SEND")
    ' Service Receiver Text
    AddReceiverText(PushService,
    <
    intent-filter>
    <action android:name=
    "com.google.android.c2dm.intent.RECEIVE" />
    <category android:name=
    "$PACKAGE$" />
    </
    intent-filter>
    <
    intent-filter>
    <action android:name=
    "com.google.android.c2dm.intent.REGISTRATION" />
    <category android:name=
    "$PACKAGE$" />
    </
    intent-filter>)
     
  8. SlashIT

    SlashIT Member Licensed User

    Solved!
    at the tutorial for sending push, I added this other tutorial, changing the parameter '#StartAtBoot: True' of the modules 'PushService' and 'NotificationService'. The result is a full-service push notifications even with the app closed (killed)!
     
    DonManfred likes this.
  9. Erel

    Erel Administrator Staff Member Licensed User

    You don't need to set StartAtBoot. Once the user explicitly kills an app it will not start again until the user explicitly starts it. This means that if you kill it from the task manager it will not receive push notifications.
     
  10. SlashIT

    SlashIT Member Licensed User

    I did all the tests possible and when I kill the process of the app (Terminate on the application menu), and send a push, the system delivers. Opening the message from the push notifications, the program is also open. I did this test: I killed the App, turned off the phone, sent the push, start the phone (the next day) and the message was delivered to me without problems, and opening the message push, is also open the App .
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice