Integrating Push Notification in Flash

0 votes

hi Im new user app42 .

But ıcant integrating my games.
Because my games pure as3 Im not using flex.
Your example code in flex.You mathing id with key use PersistenceManager.
But ıcant find any way to pure as3 in flash.
Please help me how to solve hot to use push nativation pure as3 thanks your interesting.
sory my english not god


asked Mar 26, 2014 in App42 Cloud API-BaaS by kokarcalihakan (10 points)

1 Answer

0 votes

Hi kokarcalihakan,

                              If you want to integrate Push Notification in your pure as3 projects,please follow these steps:

  • we are using persistentMangeer just used to get registration_id that is set before , while getting  from ANE.
  • So in your as3 project just remove that code and use as it is , as required , as use as it will work fine.
  • Or you can save it any of your as3 code so that you don't need to make another reuest if you register with App42 PushNotication. Just retrive last message by calling method :    'app42Push.lastMessage();' that I have used in sample

Please in case of any query , revert to us.


answered Mar 27, 2014 by Vishnu Garg (674 points)
İm still not connecting server.ı cant reqister .Somoting wrong in my code!
ı use share object i cant register id from ane. Please share working sample code or help me where ı m wrong

my code
public function Main():void
            stage.scaleMode = StageScaleMode.EXACT_FIT;
            stage.align = StageAlign.TOP_LEFT;
            stage.addEventListener(Event.DEACTIVATE, deactivate);
            // touch or gesture?
            // entry point
            // new to AIR? please read *carefully* the readme.txt files!
            if (App42Push.isSupported)
                    app42Push = new App42Push;
                    app42Push.addEventListener(App42RegistrationEvent.REGISTER, onRegistered);
                    app42Push.addEventListener(App42PushEvent.Message, onMessage);
                    // Checking if application was already registered in App42 service
                    //var registrationId:String = persistence.getProperty("registration_id") as String;
                    //so = SharedObject.getLocal("registration_id");
                    //message_txt.appendText("so:"+String( so))
                    //var registrationId:String =String(so)
                    //registered = registrationId != null;
                    so = SharedObject.getLocal("registration_id");

        private function intializeApi():void
            private function onMessage(event:App42PushEvent):void
                trace("app42 Message:", event.message);
                message_txt.appendText("app42 Message:"+String( event.message))
                //message.text=event.message as String;
        private function deactivate(e:Event):void
            // make sure the app behaves well (or exits) when in background
        private function onRegistered(event:App42RegistrationEvent):void
                trace("Registered with registration id:", event.registrationId);
                message_txt.appendText("Registered with registration id:"+ String(event.registrationId))
                // Storing registration id received from C2DM service
                so = SharedObject.getLocal("C2DM");
       = event.registrationId
                //["registration_id"] = event.registrationId;
               // persistence.setProperty("registration_id", event.registrationId);
                App42API.buildPushNotificationService().storeDeviceToken(App42API.getLoggedInUser(),event.registrationId,DeviceType.ANDROID,new App42FlashCallback());
So for connection with server just use this one and please check that your are getting registration Id in that event.

private function onRegistered(event:App42RegistrationEvent):void
                event.registrationId,DeviceType.ANDROID,new App42FlashCallback());
ıcant reach event:App42RegistrationEvent someting wrog the app desc. xml file i thing.
what code change in this xml file ?
            <manifest android:installLocation="auto">   
              <uses-permission android:name="" />
        android:protectionLevel="signature" />
    <uses-permission android:name="" />
     <uses-permission android:name="android.permission.WAKE_LOCK" />
    <!-- GCM requires a Google account. -->
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.HARDWARE_TEST" />
    <uses-permission android:name="android.permission.VIBRATE" />
            android:permission="" >

                <!-- Receives the actual messages. -->
                <action android:name="" />
                <!-- Receives the registration id. -->
                <action android:name="" />
                <category android:name="" />
        <service android:name="" >
           <meta-data android:name="push_title" android:value="PushNotificationSample"/>
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on