distriqt / airnativeextensions

DEPRECATED: Original repository of the distriqt native extensions and is no longer maintained. Please see our site for the latest ANEs
https://airnativeextensions.com
2 stars 0 forks source link

some Question about Push Notification and Alert Dialog #144

Closed daleleu closed 10 years ago

daleleu commented 10 years ago

hi, sorry for my poor english ablility.

i have some question to ask.

  1. i try to use ANE push notification in Android System ,and everything is great, i can send the msg from my computer, and receieve the msg on my cellphone, but is there any way i can send some "userdata" from my computer, and receieve this data when i tap the notification msg?

    for example : i send a msg from my computer , this msg include a data , (maybe it's a string , ex: 'Hello-world' ) , when i receieve this msg and tap it, i can launch my application , and my appliction alert this string . i have try it for 4~5 days, i still can't get this data.

  2. this is a stupid question, when I use basic Alert dialog , i put 2 buttons (ok, cancel) any way i can get the retrun value to find out user click on which button?

    two questions confuse me for really really long time. plz get me some direction to fix it, thank you very very much.

koriner commented 10 years ago

For the Alert dialog - to get the selected button, you should check the data property of the event.

For example:

Dialog.service.addEventListener( DialogEvent.DIALOG_CLOSED, dialog_closedHandler );

public function dialog_closedHandler( event:DialogEvent ):void
{
    var selected:int = parseInt( event.data );
    trace( "Selected button: " + selected);
    // selected will be an integer representing the index of the button that was tapped
}

As for your push notifications question - you will just need to parse the data received - it should be JSON.

Can you post an example of the data you are sending for the notification?