守望者--AIR技术交流

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

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

推送通知ANE案例

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

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

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

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

    开源英雄守望者

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

    The ANE binary (AirPushNotification.ane) is located in the bin folder. You should add it to your application project's Build Path and make sure to package it with your app (more information here).

    On Android, you might want to update the content of the android/res folder with your own assets. You should also update your android manifest:

    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.     <!-- The following lines have to placed inside the <application> tag-->
    8.         <receiver android:name="com.freshplanet.nativeExtensions.C2DMBroadcastReceiver"
    9.             android:permission="com.google.android.c2dm.permission.SEND">

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

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

    21.         <!-- Local notification -->
    22.         <service android:name="com.freshplanet.nativeExtensions.LocalNotificationService"/>
    23.         <receiver android:name="com.freshplanet.nativeExtensions.LocalBroadcastReceiver" android:process=":remote"></receiver>
    24. ```
    复制代码
    and replace INSERT.APP.ID.HERE by your application id ( tag in your manifest).UsageIn order to register the device for a push notifications, you should use the following method:

    1. PushNotification.getInstance().registerForPushNotification(GOOGLE_PROJECT_ID);
    复制代码
    The argument 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.Once the user has given his permission, the following event is triggered:

    1. PushNotificationEvent.PERMISSION_GIVEN_WITH_TOKEN_EVENT
    复制代码
    Build scriptShould you need to edit the extension source code and/or recompile it, you will find an ant build script (build.xml) in the build folder:
    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
    复制代码
    AuthorsThis ANE has been written by Thibaut Crenn. It belongs to FreshPlanet Inc. and is distributed under theApache Licence, version 2.0.



    相关链接:
    https://github.com/shvilam/ParseAneTest
    下载:
    百度云下载

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

    使用道具 举报

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

    本版积分规则

    
    关闭

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

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

    GMT+8, 2019-8-20 22:19 , Processed in 0.042196 second(s), 35 queries .

    守望者AIR

    守望者AIR技术交流社区

    本站成立于 2014年12月31日

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