freshplanet / ANE-Push-Notification

Air Native Extension (iOS and Android) for Push Notification
Apache License 2.0
205 stars 104 forks source link

How to setup icon for LocalPushNotification? #37

Closed surajDico closed 7 years ago

surajDico commented 10 years ago

I used below function to send LocalPushNotification but i have no idea about setting up the icon for the same. right now the notification works but I can only see the title and half the height of the message.

public function local(msg:String, sec:int, title:String):void{ if(PushNotification.getInstance().isPushNotificationSupported){ push.sendLocalNotification(msg, (((sec * 1000) + new Date().getTime())/1000), title); } }

Please if anyone can help with setting up the icon.

esdebon commented 10 years ago

You need place your icons in the "res" folder inside the ANE

surajDico commented 10 years ago

can you please share an example for this?

messi89 commented 10 years ago

you need android sdk, java jdk 1.6 and flex sdk

after just make your icons on resources folder

and execute
ant android ant swc ant package

esdebon commented 10 years ago

I use the way (is more easy):

messi89 commented 10 years ago

it's work without compile the ane ?

thank's for the trick ;)

esdebon commented 10 years ago

yes, I just try this, but I did it on windows 7, I do not know if from another operating system the "re-zipping" cause problems.

messi89 commented 10 years ago

did you have an issue with the last ane from https://github.com/freshplanet/ANE-Push-Notification/tree/feature/famepop-withOptions/bin ? this one work fine https://github.com/freshplanet/ANE-Push-Notification/tree/master/bin

but with the famepop version the app crashes

surajDico commented 10 years ago

thanks esdebon for this. but my build is not compiling. it gives me error - AirPushNotification.ane is not a valid native extension.

Can you please tell me how exactly you rezipped the files. i am on windows 7 OS.

thanks

esdebon commented 10 years ago

Really I don´t unzippe the file.

esdebon commented 10 years ago

@surajDicon I just created a new project and this crash when receiving the notification.

The LogCat says this:

05-12 11:32:34.412: E/AndroidRuntime(25815): FATAL EXCEPTION: main
05-12 11:32:34.412: E/AndroidRuntime(25815): java.lang.NoClassDefFoundError: android.support.v4.app.NotificationCompat$Builder
05-12 11:32:34.412: E/AndroidRuntime(25815):    at com.freshplanet.nativeExtensions.CreateNotificationTask.onPostExecute(Unknown Source)
05-12 11:32:34.412: E/AndroidRuntime(25815):    at com.freshplanet.nativeExtensions.CreateNotificationTask.onPostExecute(Unknown Source)
05-12 11:32:34.412: E/AndroidRuntime(25815):    at android.os.AsyncTask.finish(AsyncTask.java:631)
05-12 11:32:34.412: E/AndroidRuntime(25815):    at android.os.AsyncTask.access$600(AsyncTask.java:177)
05-12 11:32:34.412: E/AndroidRuntime(25815):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
05-12 11:32:34.412: E/AndroidRuntime(25815):    at android.os.Handler.dispatchMessage(Handler.java:99)
05-12 11:32:34.412: E/AndroidRuntime(25815):    at android.os.Looper.loop(Looper.java:137)
05-12 11:32:34.412: E/AndroidRuntime(25815):    at android.app.ActivityThread.main(ActivityThread.java:4867)
05-12 11:32:34.412: E/AndroidRuntime(25815):    at java.lang.reflect.Method.invokeNative(Native Method)
05-12 11:32:34.412: E/AndroidRuntime(25815):    at java.lang.reflect.Method.invoke(Method.java:511)

The problem is the "android.support.v4.app.NotificationCompat" class that requires to be updated, i.e. need to recompile the ANE with this upgrade.

BUT ... this error is not showing me as I was taking the facebook ANE of freshplanet, who apparently have this updated class. So a quick fix is that "imports to your" project the facebook ANE of freshplanet (no need to use it, just include it).

surajDico commented 10 years ago

Not working. just tried :(

esdebon commented 10 years ago

Use Winrar, no unzip the file only replace the files inside the program

irinelpascu commented 9 years ago

Don't change the file or folder structure. Just replace the 4 images with your ones