Code Monkey home page Code Monkey logo

ane-push-notification's Introduction

Air Native Extension for Push Notifications (iOS + Android)

This is an Air native extension for sending push notifications on iOS and Android. It has been developed by FreshPlanet and is used in the game SongPop.

Push Notifications

On iOS devices, this ANE uses Apple Push Notification Services. On Android devices, it uses Google Cloud Messaging (GCM).

Installation

If your app is iOS-only, you can directly use the binary located in the bin folder (AirPushNotification.ane). You should add it to your application project's Build Path and make sure to package it with your app (more information here).

If your app supports Android, you need to compile the ANE with your own assets (status bar icon etc...). To do that, use the ant build script located in the build folder (build.xml):

cd /path/to/the/ane/build
mv example.build.config build.config
# edit the build.config file to provide your machine-specific paths
ant

You should also update your manifest with:

```
	<!-- Only this application can receive the messages and registration result -->
	<permission android:name="INSERT.APP.ID.HERE.permission.C2D_MESSAGE" android:protectionLevel="signature" />
	<uses-permission android:name="INSERT.APP.ID.HERE.permission.C2D_MESSAGE" />
	
	<!-- This app has permission to register and receive message -->
	<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
	
	<application>

		<activity android:name="com.freshplanet.nativeExtensions.NotificationActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
		
		<receiver android:name="com.freshplanet.nativeExtensions.C2DMBroadcastReceiver"
			android:permission="com.google.android.c2dm.permission.SEND">
			
			<!-- Receive the actual message -->
			<intent-filter>
				<action android:name="com.google.android.c2dm.intent.RECEIVE" />
				<category android:name="INSERT.APP.ID.HERE" />
			</intent-filter>
			
			<!-- Receive the registration id -->
			<intent-filter>
				<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
				<category android:name="INSERT.APP.ID.HERE" />
			</intent-filter>
		</receiver>
		
		<!-- Local notification -->
		<service android:name="com.freshplanet.nativeExtensions.LocalNotificationService"/>
		<receiver android:name="com.freshplanet.nativeExtensions.LocalBroadcastReceiver" android:process=":remote"></receiver>

	</application>
```

and replace INSERT.APP.ID.HERE by your application id ( tag in your manifest).

Usage

// Register the device for a push notifications
// GOOGLE_PROJECT_ID is necessary only on Android and is your project's ID on GCM.
// On iOS, you can call the method with no parameter.
PushNotification.getInstance().registerForPushNotification(GOOGLE_PROJECT_ID);

// Register for events
PushNotification.getInstance().addEventListener(PushNotificationEvent.PERMISSION_GIVEN_WITH_TOKEN_EVENT, onPushNotificationToken);
PushNotification.getInstance().addEventListener(PushNotificationEvent.NOTIFICATION_RECEIVED_WHEN_IN_FOREGROUND_EVENT, onNotificationReceivedInForeground);
PushNotification.getInstance().addEventListener( PushNotificationEvent.APP_BROUGHT_TO_FOREGROUND_FROM_NOTIFICATION_EVENT, onNotificationReceivedInBackground);
PushNotification.getInstance().addListenerForStarterNotifications(onNotificationReceivedStartingTheApp);

// Handle events
function onPushNotificationToken(event:PushNotificationEvent):void
{
	trace("My push token is: " + event.token);
}
// other event handlers also receive a PushNotificationEvent

Packaging final app for Android

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

Notes:

  • included binary has been compiled for 64-bit iOS support

Authors

This ANE has been written by Thibaut Crenn. It belongs to FreshPlanet Inc. and is distributed under the Apache Licence, version 2.0.

Join the FreshPlanet team - GAME DEVELOPMENT in NYC

We are expanding our mobile engineering teams.

FreshPlanet is a NYC based mobile game development firm and we are looking for senior engineers to lead the development initiatives for one or more of our games/apps. We work in small teams (6-9) who have total product control. These teams consist of mobile engineers, UI/UX designers and product experts.

Please contact Tom Cassidy ([email protected]) or apply at http://freshplanet.com/jobs/

ane-push-notification's People

Contributors

adamfp avatar ataugeron avatar dmytrooverchenko avatar freshtiti avatar mateo-kozomara avatar ohalushka-gl avatar pnico avatar shinyamos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ane-push-notification's Issues

2 messages appearing

Hi, am using the same ANE.
when i send push notification, the user is receiving 2 messages for one notifications.

Please someone help if they faced the same issue.

Getting null data from GCM message

I've been trying to get notifications to work for a few days and currently, only local notifications work but the notification font size is too big. I can only see the title and half the height of the message.

Messages sent from GCM just returns me data = null.

Any way to solve this issue?

I'm testing on Samsung Galaxy S3 running Android 4.1.1

Is there a way to have an icon for the notification?

Thanks.

build.xml needs update

For platforms whose default Java is newer than 1.6 it would be helpful to update the android-build target so that javac set the following

source="1.6"
target="1.6"
bootclasspath="PATH_TO_JDK_1.6/jre/lib/rt.jar"

where PATH_TO_JDK_1.6 would be replaced by a variable in the build.config

Without this, on my system, the extCtx was null on load.

I am currently working with the Apache Flex SDK 4.11 (Air 3.9) on OSX 10.8.5 and Windows 7 x64.

Thanks for your help and sharing this project.

Android extCtx is null

I recompile the and, with my build.config file.
If I compie te iOS version, is works ok, but if try to build Android version, I got the following error:

[trace] extCtx is null.
[Fault] exception, information=TypeError: Error #1009: Cannot access a property or method of a null object reference.

Why?

thanks

Feature request

Hi and thanks for such a great ANE.

Would it be possible to add support for android notification flags?
Ex: notification.flag = Notification.FLAG_ONGOING_EVENT;

This would allow us to manually manage local notifications for apps that run in background display information like temperaturure... speed and so on... or just a message telling that app still runs in background.

Thanks!

Events not triggering in development version.

So, testing on my Android Galaxy Nexus I'm sending the HTTP POST using php. When using the the master branch, the "coming from notification event triggers", but the params var is null and I get a log error saying it's unable to parse the params. So I saw there was a development branch which I hoped would fix the parms bug and it also comes with a bunch of newly made events. But non of these events ever trigger on Android. I made the event listeners exactly the way it was recommended in the readme, but non of them work. Any ideas?

Also, this isn't really mentioned anywhere but maybe it will help someone else. At first I thought that we should listen for the notification event, then use the pushLocalNotification function to actually make the notification using the params var. But after looking into the code a little bit I saw it makes a notification for us and there are designated vars already assigned to use. What you need to send in the data JSON is "tickerText","contentTitle","contentText","pictureUrl" or "facebookId" although i'd like to mention facebookId/pictureUrl is broken. I've been testing that with no luck. but the other vars are working.

Any ideas why the events are not working? Thanks a lot for putting this ANE out here for others to use!

Does CancelLocalNotification() Work ?

Hi,

Just looking trough your java code I found the following:

package com.freshplanet.nativeExtensions;

import com.adobe.fre.FREContext;
import com.adobe.fre.FREFunction;
import com.adobe.fre.FREObject;

public class CancelLocalNotificationFunction implements FREFunction {

public CancelLocalNotificationFunction() {
    // TODO Auto-generated constructor stub
}

@Override
public FREObject call(FREContext arg0, FREObject[] arg1) {
    // TODO Auto-generated method stub
    return null;
}
}

Looks like your methods are not implemented... am I looking at the wrong files ?

IOS JSON parse error

Try use on IPAD, but PERMISSION_GIVEN_WITH_TOKEN_EVENT event never catch. In trace output I've saw this:

[trace] JSON parse error: {"name":"SyntaxError","message":"Error #1132: Invalid JSON parse input.","errorID":1132}, {"type":"status","eventPhase":2,"bubbles":false,"code":"TOKEN_SUCCESS","cancelable":false,"level":"","target":{"actionScriptData":{}},"currentTarget":{"actionScriptData":{}}}

Use AIR 3.7. Windows 7.
Thanks.

Get payload/message from notification

Hi,

How can I get/ what kind of event I get the message or payload from the notification, when the app is on the background, and the user tap the notification to ACTIVATE the application?
I read the PushNotificationEvent API, and tried the APP_STARTING_FROM_NOTIFICATION_EVENT, but the event is not triggered.

thanks

Air3.4 and armv6

Hey - I know that you'd fixed this issue with the AirFacebook.ane - just a heads up that this happens with the most current version of this .ane (the fix that you applied to the facebook.ane seemed to work)

Error occurred while packaging the application:

ld: warning: -ios_version_min not specificed, assuming 4.0
Undefined symbols for architecture armv7:
"_null", referenced from:
_g_com_adobe_air_fre_fmap in extensionglue.o
(maybe you meant: _sqlite3_bind_null, __ZN7avmplus20BitmapDataJPEGWriter14jpeg_null_charEP18jpeg_common_structPc , __ZN7CString16s_nullTerminatorE , __ZN7avmplus7AvmCore24decrementAtomRegion_nullEPii , _null_name , __ZN7avmplus20BitmapDataJPEGWriter9jpeg_nullEP18jpeg_common_struct , _sqlite3_result_null , __ZN7UString16s_nullTerminatorE )
ld: symbol(s) not found for architecture armv7
Compilation failed while executing : ld64

[PushNotification Error] cannot parse the params string

Hi! I receive this error every time during testing Push Notification on iPhone 5

Steps:

  1. Setup Push Notification for iOS
  2. Setup server to send Push Notifications (I use Urbanairship dev account for testing).
  3. Launch your ios app in debug.
  4. Send notification, in my case it looks like {"aps":{"alert":"Test","badge":1}}

Expected Result:
Event COMING_FROM_NOTIFICATION_EVENT with corresponded obect.

Actual Result:
Event COMING_FROM_NOTIFICATION_EVENT is fired but with error message:

    PushNotification Error] cannot parse the params string {
        "_" = "_S3cgDCyEeOYPQAbIbyL6A";
        aps =     {
            alert = Test;
            badge = 1;
        };
    }

Note: Notice that JSON from error message omits " symbols in property names.

Environment
iPhone 5, iOS 6.1, AIR 3.6, ANE-Push-Notification latest from ANE-Push-Notification/bin directory

unregistered when receiving GCM Message in the case of API level 15 or less

Hi.

I sent GCM message from my server. it working fine in Android 4.3.
But, in the case of Android 4.0.3, console display "Unregistered successfully".

please help me... help... please.....

        <manifest android:installLocation="auto">
            <uses-permission android:name="android.permission.INTERNET"/>
            <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
            <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
            <uses-permission android:name="android.permission.GET_ACCOUNTS" />
            <uses-permission android:name="android.permission.WAKE_LOCK" />
            <uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch"/>
            <permission android:name="push.test.permission.C2D_MESSAGE" android:protectionLevel="signature" />
            <uses-permission android:name="push.test.permission.C2D_MESSAGE" />
            <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
            <application android:enabled="true" android:debuggable="true">
                <activity android:name="com.freshplanet.nativeExtensions.NotificationActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
                <receiver android:name="com.freshplanet.nativeExtensions.C2DMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
                   <intent-filter>
                       <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                       <category android:name="push.test" />
                   </intent-filter>
                   <intent-filter>
                       <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                       <category android:name="push.test" />
                   </intent-filter>
               </receiver>
               <service android:name="com.freshplanet.nativeExtensions.LocalNotificationService"/>
               <receiver android:name="com.freshplanet.nativeExtensions.LocalBroadcastReceiver" android:process=":remote"></receiver>
                <activity android:excludeFromRecents="false">
                    <intent-filter>
                        <action android:name="android.intent.action.MAIN"/>
                        <category android:name="android.intent.category.LAUNCHER"/>
                    </intent-filter>
                </activity>
            </application>
        </manifest>

Push Notification in Android While App Closed

Help me.......

Project Status

mobile : Andriod Galaxy s4
apk deployment : production(X), Beta(O), Alpa(O),

Question?

When app is running, it gets the “Push Notification” and shows the messages.
But while app is off, or terminated, there is no answer from Mobile, even though I send messages.
Please let me know if there is something I missed,
or is it just Push Ane system working this way? When App is offline, it doesn’t get any Push Notification?

Thanks

unrecognized event REGISTERING

Android change cloud, I did what you said change the value in registerForPushNotification(). Instead of the email adress, put my projectId. But when I debug I got "unrecognized event REGISTERING" and stop there. what should I do next?

Can't build with AIR 3.7

Hi, I'm trying to run the ANE in iOS, but building failed.
because recently AIR SDK has Push notification support within itself.
So, the following errors.

C:\Home\src\flex\PushSample\bin-debug>adt -package -target ipa-test-interpreter -hideAneLi
bSymbols no -provisioning-profile C:\Home\src\flex\PushSample\dpika_airmobilesample-2.mobil
eprovision -storetype pkcs12 -keystore C:\Home\src\flex\FlexMobileSample2\pikapika_dist.p12
PushSample.ipa PushSample-app.xml DebugHostInfo.xml PushSample.swf -extdir "C:\Users\h_ut
sunomiya\Adobe Flash Builder 4.7.metadata.plugins\com.adobe.flexbuilder.project.ui\ANEFi
les\PushSample\com.adobe.flexide.multiplatform.ios.platform"
password:
duplicate symbol _FRPE_ApplicationDidReceiveRemoteNotificationKey in:
C:\Home\local\Adobe\AIRSDK_Compiler-3.7.0\lib\aot/lib/libRuntimeInterpreter.arm-
air.a(CTAIRAppController+PrivateExtensions.o)
C:\Home\local\Adobe\AIRSDK_Compiler-3.7.0\lib\aot/lib/libNotification.arm-air.a(
CTAIRAppController+NotificationExtensions.o)
duplicate symbol _FRPE_ApplicationDidReceiveRemoteNotification in:
C:\Home\local\Adobe\AIRSDK_Compiler-3.7.0\lib\aot/lib/libRuntimeInterpreter.arm-
air.a(CTAIRAppController+PrivateExtensions.o)
C:\Home\local\Adobe\AIRSDK_Compiler-3.7.0\lib\aot/lib/libNotification.arm-air.a(
CTAIRAppController+NotificationExtensions.o)
duplicate symbol _FRPE_ApplicationDidRegisterForRemoteNotificationsWithDeviceTokenKey in:
C:\Home\local\Adobe\AIRSDK_Compiler-3.7.0\lib\aot/lib/libRuntimeInterpreter.arm-
air.a(CTAIRAppController+PrivateExtensions.o)
C:\Home\local\Adobe\AIRSDK_Compiler-3.7.0\lib\aot/lib/libNotification.arm-air.a(
CTAIRAppController+NotificationExtensions.o)
duplicate symbol _FRPE_ApplicationDidRegisterForRemoteNotificationsWithDeviceToken in:
C:\Home\local\Adobe\AIRSDK_Compiler-3.7.0\lib\aot/lib/libRuntimeInterpreter.arm-
air.a(CTAIRAppController+PrivateExtensions.o)
C:\Home\local\Adobe\AIRSDK_Compiler-3.7.0\lib\aot/lib/libNotification.arm-air.a(
CTAIRAppController+NotificationExtensions.o)
duplicate symbol _FRPE_ApplicationDidFailToRegisterForRemoteNotificationsWithErrorKey in:
C:\Home\local\Adobe\AIRSDK_Compiler-3.7.0\lib\aot/lib/libRuntimeInterpreter.arm-
air.a(CTAIRAppController+PrivateExtensions.o)
C:\Home\local\Adobe\AIRSDK_Compiler-3.7.0\lib\aot/lib/libNotification.arm-air.a(
CTAIRAppController+NotificationExtensions.o)
duplicate symbol _FRPE_ApplicationDidFailToRegisterForRemoteNotificationsWithError in:
C:\Home\local\Adobe\AIRSDK_Compiler-3.7.0\lib\aot/lib/libRuntimeInterpreter.arm-
air.a(CTAIRAppController+PrivateExtensions.o)
C:\Home\local\Adobe\AIRSDK_Compiler-3.7.0\lib\aot/lib/libNotification.arm-air.a(
CTAIRAppController+NotificationExtensions.o)
ld: 6 duplicate symbols for architecture armv7
Compilation failed while executing : ld64

comments?

Push listeners when app is closed Android need help

in first i would like to thank you for your great work
i am a flex builder and java developer i am using your Push ANE for a mobile news app witch redirect to the news detail when click on notification.
I am working on android and ios till now i have .

iphone(ios) : Opened -> listens and redirect in debug but no sounds(ok with it)
Background-> listens open app and redirect in debug (normally)
Closed->listens open app and redirect in debug and run (normally)
Android: Opened -> listens and redirect in debug with sound (normally)
Background-> listens open app and redirect in debug (normally)
Closed->just open app and sound but cannot listen

any ideas for android ? if app is closed ?

Discrepancy between SWC and PushNotificationEvent

Codecompletion based on the PushNotificationEvent class in the swc suggests en event type of: NOTIFICATION_RECEIVED_EVENT
but in AS / src / com / freshplanet / nativeExtensions / PushNotificationEvent.as the static constant is COMING_FROM_NOTIFICATION_EVENT

Unable to get it working with iOS

Hi I am trying to use the ane , I could see the trace as "Push notification is supported" but the PERMISSION_GIVEN_WITH_TOKEN_EVENT doesn't get dispatched nor PERMISSION_REFUSED_EVENT

GCM never register

I am new to Flex. I want to simple application with using GCM. I register Google API and I get a project id. I try to use ANE but not register. And my second question is how can I change Android Manifest file?

My simple code is :
PushNotification.getInstance().registerForPushNotification(GOOGLE_PROJECT_ID);
PushNotification.getInstance().addEventListener(PushNotificationEvent.PERMISSION_GIVEN_WITH_TOKEN_EVENT,onPermissionGivenToken);
PushNotification.getInstance().addEventListener(PushNotificationEvent.PERMISSION_REFUSED_EVENT,onPermissionRefused);

Using with Flashdevelop

Hi

i am trying to use the PushNotification in a Flash AS3 Air Project.
I can include the lib and Change the manifest in the application.xml.
On the desktop-test all is ok, but wenn i build an ipa or apk i have a "blue" Screen and im debugscreen stand that "PushNotification.getInstance().registerForPushNotification("mynumber");" is null. i dont have more loggs, becaurse the tablet is not connected with usb-cable.

I have build my own ane with adt-ant.
where can i search the error.


now i can Register my App and becam an token. but the app only work on tablets or phones nor in a Simulator, but that is not importent.

to send a message i use a php scrip, with the token and my app_key.
the message has success in the result and the app does terminated self.
but no notification ? :(

sorry for my bad english
thanks
Thomas

app crash with provided default ane

i use the ane file provided in the bin/ folder but can't get anything right.

i publish and test my app for android, app crash either with local or distant notifications

the error i get is

java.lang.NullPointerException
at com.freshplanet.nativeExtensions.CreateNotificationTask.onPostExecute(Unknown Source)
at com.freshplanet.nativeExtensions.CreateNotificationTask.onPostExecute(Unknown Source)
at android.os.AsyncTask.finish(AsyncTask.java:631)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5086)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
at dalvik.system.NativeStart.main(Native Method)

i guess that has something to do with the following in the 'documentation' but don't know what to do with (which assets i should provide and how to update ?)

[quote]
If your app supports Android, you need to compile the ANE with your own assets (status bar icon etc...). To do that, use the ant build script located in the build folder (build.xml):

cd /path/to/the/ane/build
mv example.build.config build.config
edit the build.config file to provide your machine-specific paths
ant
[/quote]

otherwise my FlashDevelop project should be well configured (application.xml with the right permissions and extensionID)
i can compile it with no worry

thanks for the help

PERMISSION_REFUSED_EVENT not triggered on iOS 6 AIR 3.5

Hi

I'm trying this ane on my iPod touch running iOS 6 with Air 3.5.

On first install of the app, if I click on "Don't allow" for push notifications, I am not getting the PERMISSION_REFUSED_EVENT triggered.
So my app just hangs there.

When I go to my Settings->Notifications and play around with the Alert Styles (switching it from None to Alerts back to None). I relaunch my app, then I get the PERMISSION_GIVEN_WITH_TOKEN_EVENT event triggered.

Shouldn't it be the PERMISSION_REFUSED_EVENT triggering in both my scenarios above?

Thanks!

Is there a documentation?

i'm having a hard time understanding what i must do to get it working.
is there any source code? or tutorial? or documentation for using this ANE?

thanks!

onIncomingNotifiation nonrespondent when app is deactivated

I'm sure there are a few ways to skin this cat but I'm wondering if anyone has run into this.

I'm trying to make a badge count for notifications and I've noticed that when the app is deactivated (ideally when you'd want to display badges) - so are the listeners. Is there any way to work around this? Anything I'm missing?

-Matt

Layout issue with Notify Me!

I'm testing on a device with Android 4.1, and in order to get notifications to display in the lock screen I'm using Notify Me!.

When I launch a notification to my app with the ANE, the notification dialog isn't correctly displayed, instead of having the size of a normal notification, it is covering all the screen. Of all the applications I have set to display in the lock screen, only the one with this ANE show this wrong behaviour.

My App Crashed when recieving GCM Message

hi guys..

I sent GCM message from my server, and it makes my application crash right after I sent it.
I think there is no wrong with my server code, Think sth is wrong with my manifest. can someone give me an answer?

my manifest looks like this

16bit <manifest> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <permission android:name="air.kr.elever.appElever.debug.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="air.kr.elever.appElever.debug.permission.C2D_MESSAGE" /> <application> <receiver android:name="com.freshplanet.nativeExtensions.C2DMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND"> <intent-filter> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> <category android:name="air.kr.elever.appElever.debug" /> </intent-filter> </receiver> <activity android:name="com.freshplanet.nativeExtensions.NotificationActivity"></activity> <service android:name="com.freshplanet.nativeExtensions.LocalNotificationService"/> <receiver android:name="com.freshplanet.nativeExtensions.LocalBroadcastReceiver" android:process=":remote"></receiver> </application> </manifest> ]]></manifestAdditions> </android>

Missing android.support.v4

Hi,

I've been struggling for a while now trying to get this extension to work.
It all comes down to a problem due to a missing library in the ANE (whatever the version):

Could not find class 'android.support.v4.app.NotificationCompat$Builder', referenced from method com.freshplanet.nativeExtensions.CreateNotificationTask.onPostExecute

The solution (described by smart contributers) is to tweak the build.xml and recompile the ANE.

For all those of us who don't know how to recompile this ANE (setting up a working environment to compile it is a pain), could you post a new revision of the extension including that library?

Thank you for sharing this great ANE with all of us. It's just a small step away from being perfect!

registerForPushNotification() not always triggering PERMISSION_REFUSED_EVENT

Hi,

First of all, the master branch is currently broken! There is a mean typo in PushNotification.as: TOKEN_FAILT instead of TOKEN_FAIL. Develop branch is fixed and should be merged as soon as possible.

However, even in develop branch, the PERMISSION_REFUSED_EVENT is not dispatched by registerForPushNotification if the user has already disabled push in his settings. Example: install, refuse push, uninstall, reinstall (no popup on second installs) => no fail event, no success event

Regards,

Cameron

How to setup icon for LocalPushNotification?

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.

Push icon

Hi,

is there a way to set the application icon in the pushes I send from the server?
Thanks.

Vincent.

Error: No resource found

I am trying to compile an app in Flash Builder, AIR 3.7 but before the compile completes I receive the following error:

aapt tool failed:/private/var/folders/9c/_g8fcpxs15q6tp63vms4nkgr0000gn/T/344e7f4c-65d9-4df6-8722-16ba7baa43de/res/layout/com_facebook_usersettingsfragment.xml:48: error: Error: No resource found that matches the given name (at 'style' with value '@style/com_facebook_loginview_silver_style').

Any advice would be fantastic,

Dave.B

APP_STARTED_IN_BACKGROUND_FROM_NOTIFICATION

Hi everyone,

I'm trying to run some actionscript inside app after new push notification with parameter content-available:true was received. Is there any options to complete this with AIR and Flex and freshplanet ANE?

Many thanks
Dan

custome notification icon BUT not from resources inside ane!

in your code, I can see that you are using a custom icon for the notification using resources inside the extension

  registerResources(context);

I wonder if you can think of a creative solution to grab the icon (or the sound) from sdcard without having to put the address from inside the .java source?

if the as3 developer is able to set the address to the icon and the sound file from the air interface, would be so cool, wouldn't it?

the main problem that I face is that when the air app is closed, the FREcontext is null and I cannot have access to the settings (location of icons and sounds) that the AS3 interface has set.

do you have any idea? anyone?

Attempting to Integrate Parse Push Notifications

I am trying to integrate the Parse service (http://parse.com/) in the ANE, which involves a few lines of code and the Linking of the Parse Framework (just getting the iOS side to work for now).

Link in the Parse SDK (https://www.parse.com/downloads/ios/parse-library/latest)
Code parts as follows:

#import <Parse/Parse.h>
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)newDeviceToken {
    // Store the deviceToken in the current installation and save it to Parse.
    PFInstallation *currentInstallation = [PFInstallation currentInstallation];
    [currentInstallation setDeviceTokenFromData:newDeviceToken];
    [currentInstallation saveInBackground];
}

and

- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo {
    [PFPush handlePush:userInfo];
}

I can package the the ANE via the Build script just fine.

But when I package the IAP with that ANE I get a package error:

Compilation failed while executing : ld64

Can't send local notifications

Hi,

I can't figure how to setup a local notification. I think I'm doing all configurations right and the app don't send a local notification. My code:

var _pushNotification:PushNotification = PushNotification.getInstance();
_pushNotification.registerForPushNotification(GOOGLE_PROJECT_ID);
_pushNotification.sendLocalNotification("test", 1369827600, "test");

1369827600 = 05/29/2013, 11:40:00 AM in seconds ( Since 1/1/1970 ) and, when I install the apk on my phone, the phone hour was 05/29/2013, 11:32.

This is a real issue or am I doing something wrong?

implementing PNS ane in starling project.

Hello,
have anyone tried implementing this ANE in starling project?

Am new with starling, i have implemented this functionality in Flash cs6.6 android app before.

please share if anyone ever implemented it.

thanks....

[Resolved] "${flex.sdk}/bin/adt${bin.ext}" not found

Hi

In order to add my app icons in the ane

after editing build.config to configure the bin.ext, flex.sdk android.res and android.sdk

I run
ant android ==> OK
ant swc ==> OK

but when I try
ant package I have an error

It say adt.exe not found
I check the bin folder in the flex sdk and there are no adt.exe (only adt and adt.bat)

any idea ?

extCtx is null

i got files from master blanch.

i only change

  • build.config
  • xcode's FlashRuntimeExtensions.h path

after ,i did ant. ant says BUILD SUCCESSFUL.
after, i publish AIR for Android. Flash says SUCCESS.
but it didnt start. in debug mode log, "extCtx is null".

what should i do?

my environment is
osx 01.8.2
java version "1.6.0_37"
xcode Version 4.5.2


build.config
name = AirPushNotification
flex.sdk = /Applications/Adobe Flash Builder 4.7/sdks/4.6.0
bin.ext =
ios.sdkversion = iphoneos6.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.