Backendless Support
 
Solved

HELP! FLASH Push Notifications iOS Android Pandemonium

OK, so, I managed to register iOS device and receive notifications.

But I had to Add the Class on this post.

http://support.backendless.com/topic/as3-sdk-open-source-with-blank-function

Now I'm trying to do the same on Android.

So, I followed the steps in order to get an API KEY and PROJECT NUMBER from Google Cloud Messaging Service.

On my APP xml i have de following ID tag:

  1. <id>com.robertocorrales.AMPA-Jaume-Balmes-BCN</id>

On my Manifest bit I have this code:

  1. <manifestAdditions><![CDATA[
  2. <manifest android:installLocation="auto">
  3. <uses-permission android:name="android.permission.INTERNET"/>
  4. <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
  5. <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
  6. <uses-permission android:name="air.com.robertocorrales.AMPA-Jaume-Balmes-BCN.permission.C2D_MESSAGE" />
  7. <permission android:name="air.com.robertocorrales.AMPA-Jaume-Balmes-BCN.permission.C2D_MESSAGE" android:protectionLevel="signature" />
  8. <application android:enabled="true">
  9. <activity android:excludeFromRecents="false">
  10. <intent-filter>
  11. <action android:name="android.intent.action.MAIN"/>
  12. <category android:name="android.intent.category.LAUNCHER"/>
  13. </intent-filter>
  14. </activity>
  15. <receiver android:name="com.backendless.messaging.C2DMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
  16. <!-- Receive the actual message -->
  17. <intent-filter>
  18. <action android:name="com.google.android.c2dm.intent.RECEIVE" />
  19. <category android:name="air.com.robertocorrales.AMPA-Jaume-Balmes-BCN" />
  20. </intent-filter>
  21. <!-- Receive the registration id -->
  22. <intent-filter>
  23. <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
  24. <category android:name="air.com.robertocorrales.AMPA-Jaume-Balmes-BCN" />
  25. </intent-filter>
  26. </receiver>
  27. </application>
  28. </manifest>
  29. ]]></manifestAdditions>

My AS3 code for registering looks like this:

  1. private function registerDevice():void{
  2. var responder:IResponder = new mx.rpc.Responder( function( event:ResultEvent ):void{
  3. trace("device has been registered");
  4. var registration:DeviceRegistration = event.result as DeviceRegistration;
  5. },
  6. function faultEvent( fault:FaultEvent ):void{
  7. trace("received error - " + fault);
  8. });
  9. var deviceRegistration:DeviceRegistration = new DeviceRegistration();
  10. // when running on Android, make sure to set the value. The property is ignored on the iOS devices;
  11. deviceRegistration.gcmSenderId = "48152854762";
  12. //NOT USING CHANNELS
  13. //deviceRegistration.channels = [ "My Channel" ];
  14. Backendless.Messaging.registerDevice(deviceRegistration, receivedPushNotification, responder);
  15. }
  16. public function gotResultF(e:ResultEvent):void{
  17. var registration:DeviceRegistration = e.result as DeviceRegistration;
  18. trace( "OK");
  19. }
  20. public function gotErrorF( e:FaultEvent ):void{
  21. //var errorMessage:String = e.fault.faultString;
  22. trace( "received error");
  23. }

Once I open the App, I check on the Messages console and see the I have the Android device registered.

Then I try to send a Push from console whit this headers:

"android-ticker-text":"New Push Test","android-content-title":"TITLE","android-content-text":"TEST ANDROID"

And then.......

Nothing...

What am I doing wrong?

Do you have a FLASH (not Flex) working Example?

Could it be something wrong with the ANE? (just downloaded from Git)

Do I have to do something else with the ANE?

For example, freshplanet/ANE-Push-Notification ANE has this last step (that I don't really understand) in order to make it work.

Packaging final app for Android - freshplanet/ANE-Push-Notification ANE

When you build your final APK for Android, you need to update (patch) the AIRSDK you're using. First, make sure you download the latest build-tools (from the Android SDK manager). Then, patch your AIR SDK with the following command: cp pathtoyourANDROIDSDK/build-tools/22.0.1/lib/dx.jar pathtoyourAIRSDK/lib/android/bin/dx.jar

THANKS!!!!!

By the way. I love the platform, and usually develop native iOS Apps that work flawlessly with Backendless.

But in this case I hace to do an AIR one.

Leave a Comment

Comments (7)

photo
1

Roberto,

Would it help if we shared the source code for the ANE with you? It's been hard for us to allocate resources to the AS SDK since the demand for it very low, but it would be fantastic if you could help out there.

Regards,

Mark

photo
1

Hi Mark, any news about this?

Sorry to hassle you, but, altho the project deadline is not soon, I have everything developed in AIR/Backendeless and now I have to decide if to switch to a different technology or not.

Thanks!

photo
1

Hi Roberto,

I uploaded the source code for the ANE to dropbox, you can grab it from:

https://www.dropbox.com/s/r5r973l3wotw554/backendlessane.zip?dl=0

Regards,

Mark

photo
1

Thanks. I'll have a look and let you know.

photo
photo
1

To be honest, I don't know. I don't have experience on building ANEs but If you think it worth the try, let me have a look.

Isn't anyone on the community with a fully working example?

Thanks.

Regards,

Roberto

photo
1

Also, this happens compiling to AIR17.

If I try to compile with a higher AIR (20 or 21) I get this huge error... Maybe it rings a bell...

aapt tool failed:/private/var/folders/2l/_b8c7hj11xzczh7pmlpq9lmw0000gn/T/d755eed8-70ea-4125-9105-c4ae07fedf0c/res/drawable-ldpi-v9/app_icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

/private/var/folders/2l/_b8c7hj11xzczh7pmlpq9lmw0000gn/T/d755eed8-70ea-4125-9105-c4ae07fedf0c/res/drawable/app_icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

/private/var/folders/2l/_b8c7hj11xzczh7pmlpq9lmw0000gn/T/d755eed8-70ea-4125-9105-c4ae07fedf0c/res/drawable-ldpi/app_icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

/private/var/folders/2l/_b8c7hj11xzczh7pmlpq9lmw0000gn/T/d755eed8-70ea-4125-9105-c4ae07fedf0c/res/drawable-ldpi-v11/app_icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

/private/var/folders/2l/_b8c7hj11xzczh7pmlpq9lmw0000gn/T/d755eed8-70ea-4125-9105-c4ae07fedf0c/res/drawable-mdpi/app_icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

/private/var/folders/2l/_b8c7hj11xzczh7pmlpq9lmw0000gn/T/d755eed8-70ea-4125-9105-c4ae07fedf0c/res/drawable-mdpi-v9/app_icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

/private/var/folders/2l/_b8c7hj11xzczh7pmlpq9lmw0000gn/T/d755eed8-70ea-4125-9105-c4ae07fedf0c/res/drawable-mdpi-v11/app_icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

/private/var/folders/2l/_b8c7hj11xzczh7pmlpq9lmw0000gn/T/d755eed8-70ea-4125-9105-c4ae07fedf0c/res/drawable-hdpi/app_icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

/private/var/folders/2l/_b8c7hj11xzczh7pmlpq9lmw0000gn/T/d755eed8-70ea-4125-9105-c4ae07fedf0c/res/drawable-hdpi-v9/app_icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

/private/var/folders/2l/_b8c7hj11xzczh7pmlpq9lmw0000gn/T/d755eed8-70ea-4125-9105-c4ae07fedf0c/res/drawable-hdpi-v11/app_icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

/private/var/folders/2l/_b8c7hj11xzczh7pmlpq9lmw0000gn/T/d755eed8-70ea-4125-9105-c4ae07fedf0c/res/drawable-xhdpi/app_icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

/private/var/folders/2l/_b8c7hj11xzczh7pmlpq9lmw0000gn/T/d755eed8-70ea-4125-9105-c4ae07fedf0c/res/drawable-xhdpi-v9/app_icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

/private/var/folders/2l/_b8c7hj11xzczh7pmlpq9lmw0000gn/T/d755eed8-70ea-4125-9105-c4ae07fedf0c/res/drawable-xhdpi-v11/app_icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

/private/var/folders/2l/_b8c7hj11xzczh7pmlpq9lmw0000gn/T/d755eed8-70ea-4125-9105-c4ae07fedf0c/res/drawable/icon_status.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

/private/var/folders/2l/_b8c7hj11xzczh7pmlpq9lmw0000gn/T/d755eed8-70ea-4125-9105-c4ae07fedf0c/res/drawable-ldpi/icon_status.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

/private/var/folders/2

photo
1

ok, AIR 17, 18, and 19 compiles but doesn't get any push.

Fron AIR 20 and above does not compile and throws that weird error mentioned before...