守望者--AIR技术交流

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
热搜: ANE FlasCC 炼金术
查看: 1684|回复: 0

推送通知ANE(iOS and Android)

[复制链接]
  • TA的每日心情
    擦汗
    2018-4-10 15:18
  • 签到天数: 447 天

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

    Rank: 18Rank: 18Rank: 18Rank: 18Rank: 18

    威望
    562
    贡献
    29
    金币
    51756
    钢镚
    1422

    开源英雄守望者

    发表于 2015-1-22 09:59:09 | 显示全部楼层 |阅读模式
    应用下载
    应用名称: ANE-Push-Notification
    支持64位:
    当前版本: 未知
    运行平台: Android IOS 
    开发语言: ActionScript 3 JAVA 其他 
    应用类别: ANE-多平台
    应用简介: Air Native Extension (iOS and Android) for Push Notification
    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):

    1. cd /path/to/the/ane/build
    2. mv example.build.config build.config
    3. # edit the build.config file to provide your machine-specific paths
    4. ant
    复制代码
    You should also update your manifest with:

    1. ```
    2.     <!-- Only this application can receive the messages and registration result -->
    3.     <permission android:name="INSERT.APP.ID.HERE.permission.C2D_MESSAGE" android:protectionLevel="signature" />
    4.     <uses-permission android:name="INSERT.APP.ID.HERE.permission.C2D_MESSAGE" />

    5.     <!-- This app has permission to register and receive message -->
    6.     <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

    7.     <application>

    8.         <activity android:name="com.freshplanet.nativeExtensions.NotificationActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />

    9.         <receiver android:name="com.freshplanet.nativeExtensions.C2DMBroadcastReceiver"
    10.             android:permission="com.google.android.c2dm.permission.SEND">

    11.             <!-- Receive the actual message -->
    12.             <intent-filter>
    13.                 <action android:name="com.google.android.c2dm.intent.RECEIVE" />
    14.                 <category android:name="INSERT.APP.ID.HERE" />
    15.             </intent-filter>

    16.             <!-- Receive the registration id -->
    17.             <intent-filter>
    18.                 <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
    19.                 <category android:name="INSERT.APP.ID.HERE" />
    20.             </intent-filter>
    21.         </receiver>

    22.         <!-- Local notification -->
    23.         <service android:name="com.freshplanet.nativeExtensions.LocalNotificationService"/>
    24.         <receiver android:name="com.freshplanet.nativeExtensions.LocalBroadcastReceiver" android:process=":remote"></receiver>

    25.     </application>
    26. ```
    复制代码
    and replace INSERT.APP.ID.HERE by your application id ( tag in your manifest).Usage
    1. // Register the device for a push notifications
    2. // GOOGLE_PROJECT_ID is necessary only on Android and is your project's ID on GCM.
    3. // On iOS, you can call the method with no parameter.
    4. PushNotification.getInstance().registerForPushNotification(GOOGLE_PROJECT_ID);

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

    10. // Handle events
    11. function onPushNotificationToken(event:PushNotificationEvent):void
    12. {
    13.     trace("My push token is: " + event.token);
    14. }
    15. // other event handlers also receive a PushNotificationEvent
    复制代码
    Notes:
    • included binary has been compiled for 64-bit iOS support
    AuthorsThis ANE has been written by Thibaut Crenn. It belongs to FreshPlanet Inc. and is distributed under theApache Licence, version 2.0.Join the FreshPlanet team - GAME DEVELOPMENT in NYCWe 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 (tcassidy@freshplanet.com) or apply at http://freshplanet.com/jobs/



    相关链接:
    https://github.com/freshplanet/ANE-Push-Notification
    下载

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有帐号?立即注册

    x
    守望者AIR技术交流社区(www.airmyth.com)
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    
    关闭

    站长推荐上一条 /4 下一条

    QQ|手机版|Archiver|网站地图|小黑屋|守望者 ( 京ICP备14061876号

    GMT+8, 2019-10-22 06:42 , Processed in 0.045936 second(s), 34 queries .

    守望者AIR

    守望者AIR技术交流社区

    本站成立于 2014年12月31日

    快速回复 返回顶部 返回列表