守望者--AIR技术交流

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
热搜: ANE FlasCC 炼金术
查看: 2350|回复: 7

google推送,googleplay ANE(Android)

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

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

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

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

    开源英雄守望者

    发表于 2015-1-24 14:22:47 | 显示全部楼层 |阅读模式
    应用下载
    应用名称: google推送,googleplay ANE(Android)
    支持64位:
    当前版本: 未知
    运行平台: Android 
    开发语言: ActionScript 3 JAVA 
    应用类别: ANE-JAVA
    应用简介: google推送,googleplay ANE(Android)
    google推送,googleplay  ANE(Android)




    google推送服务端.php
    1. <?php
    2. define("GOOGLE_API_KEY", "AIzaSyBtxRXUFoJnXJlkmcqkFWs87kwRE4Y5GRs");

    3. function send_push_notification($registatoin_ids, $message) {
    4.         

    5.         // Set POST variables
    6.         $url = 'https://android.googleapis.com/gcm/send';

    7.         $fields = array(
    8.             'registration_ids' => $registatoin_ids,
    9.             'data' => $message,
    10.         );

    11.         $headers = array(
    12.             'Authorization: key=' . GOOGLE_API_KEY,
    13.             'Content-Type: application/json'
    14.         );
    15.                 //print_r($headers);
    16.         // Open connection
    17.         $ch = curl_init();

    18.         // Set the url, number of POST vars, POST data
    19.         curl_setopt($ch, CURLOPT_URL, $url);

    20.         curl_setopt($ch, CURLOPT_POST, true);
    21.         curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    22.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    23.         // Disabling SSL Certificate support temporarly
    24.         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

    25.         curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));

    26.         // Execute post
    27.         $result = curl_exec($ch);
    28.         if ($result === FALSE) {
    29.             die('Curl failed: ' . curl_error($ch));
    30.         }

    31.         // Close connection
    32.         curl_close($ch);
    33.         echo $result;
    34.     }
    35.         $registatoin_ids = array("APA91bHUUwpzbsqeXWyZg2gQHaBuI7evfR7Q5_DrnhQ7gqlwLv68Cq346cQAUB4NWX5T3X2FvFfIfwj9ABnf2yFbKamSlmW4AampE3Vo0Mgh8GC1VfFDqRF2tqaqdVEzg6VxQiFgJGX0bSXfMAVKHEAEUYj4Ljoo6-MMCPIIYuPRB4aCPQ7TzxTSaeQmgW0cfuSfh772dPdn");
    36.     $message = array("message"=>"hello world","action"=>"com.antoinecampbell.gcmdemo.ECHO");
    37.         send_push_notification($registatoin_ids,$message);
    38. ?>
    复制代码



    本资源来自:ANE开源群 307700284

    本帖子中包含更多资源

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

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

    使用道具 举报

  • TA的每日心情
    擦汗
    2018-4-10 15:18
  • 签到天数: 447 天

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

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

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

    开源英雄守望者

     楼主| 发表于 2015-1-29 15:43:46 | 显示全部楼层
    本帖最后由 破晓 于 2015-3-26 14:36 编辑

    相关下载:

    https://github.com/alextel69/google-play-game-services-ane


    http://www.airmyth.com/thread-1255-1-1.html
    守望者AIR技术交流社区(www.airmyth.com)
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    擦汗
    2018-4-10 15:18
  • 签到天数: 447 天

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

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

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

    开源英雄守望者

     楼主| 发表于 2015-1-30 16:48:53 | 显示全部楼层
    谷歌云消息/推送通知

    Google Cloud Messaging / Push Notification Native Extension for Android


    Push Notification ANE for Android

    GCM_ANE - Push Notification Native Extension for Android applications using GCM (Google Cloud Messaging)

    This ANE based on Afterick's idea.

    Version

    This is version 1.0 of this extension.

    Extension ID
    1. <extensionID>com.janumedia.ane.gcm</extensionID>
    复制代码
    Usage

    You will need the Project Number as GCM_SENDER_ID from the Google APIs Console where you enabled GCM. More information about GCM you can start from here

    1. var gcm:GCMExtension; = new GCMExtension();
    2. //trace (GCMExtension.VERSION);
    3. gcm.addEventListener(GCMEvent.REGISTERED, handleRegistered, false, 0, true);
    4. gcm.addEventListener(GCMEvent.UNREGISTERED, handleUnregistered, false, 0, true);
    5. gcm.addEventListener(GCMEvent.MESSAGE, handleMessage, false, 0, true);
    6. gcm.addEventListener(GCMEvent.ERROR, handleError, false, 0, true);
    7. gcm.addEventListener(GCMEvent.RECOVERABLE_ERROR, handleError, false, 0, true);
    8. gcm.register(GCM_SENDER_ID);
    复制代码
    Make sure to add this permission on your manifest file:

    1. <!-- App receives GCM messages. -->
    2. <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    3. <!-- GCM connects to Google Services. -->
    4. <uses-permission android:name="android.permission.INTERNET" />
    5. <!-- GCM requires a Google account. -->
    6. <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    7. <permission android:name="air.YOUR_APP_BUNDLE_ID_HERE.permission.C2D_MESSAGE" android:protectionLevel="signature" />
    8. <uses-permission android:name="air.YOUR_APP_BUNDLE_ID_HERE.permission.C2D_MESSAGE" />
    复制代码
    Add inside Application tag, update YOUR_APP_BUNDLE_ID_HERE.

    1. <service android:name="com.janumedia.ane.gcm.GCMPushIntentService" />
    2. <receiver android:name="com.janumedia.ane.gcm.GCMPushBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" >
    3.     <intent-filter>
    4.         <action android:name="com.google.android.c2dm.intent.RECEIVE" />
    5.         <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
    6.         <category android:name="YOUR_APP_BUNDLE_ID_HERE" />
    7.     </intent-filter>
    8. </receiver>
    复制代码
    AuthorThis ANE has been writen by I Nengah Januartha. It belongs to JanuMedia Inc. and is distributed under theApache Licence, version 2.0.




    相关链接:
    https://github.com/janumedia/GCM_ANE

    本帖子中包含更多资源

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

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

    使用道具 举报

  • TA的每日心情
    擦汗
    2018-4-10 15:18
  • 签到天数: 447 天

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

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

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

    开源英雄守望者

     楼主| 发表于 2015-3-27 15:53:15 | 显示全部楼层
    谷歌云消息ANE



    https://github.com/breealyeska/GCMExtension

    本帖子中包含更多资源

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

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

    使用道具 举报

  • TA的每日心情
    擦汗
    2018-4-10 15:18
  • 签到天数: 447 天

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

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

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

    开源英雄守望者

     楼主| 发表于 2015-4-3 16:14:53 | 显示全部楼层
    本帖最后由 破晓 于 2015-4-3 16:18 编辑

    https://github.com/nitacawo/Goog ... Overlawled-examples


    Instructions
    • Well first of all run up to date air sdk
    • Upload apk with google play services implemented in console. You must use the same certificate.


    • Connect your game with game services(In google developer console>game services>add a new game)

    • Modify your-app.xml file Package name in console must be with air. and be the same as your app idin xml

      1. <id>TrollBootman</id>
      复制代码
      1. <android>
      2.       <manifestAdditions><![CDATA[<manifest>
      3. <uses-sdk android:minSdkVersion="9"></uses-sdk>
      4. <application>

      5.             <!-- GooglePlay Games Services -->
      6.             <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ 84364063738" />
      7.             <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
      8.             <activity android:name="com.freshplanet.googleplaygames.SignInActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
      9.         </application>  
      10. </manifest>]]></manifestAdditions>
      11. </android>
      复制代码

      • if your app shows the google play window but fails to connect or crashes check out the issue which might happenGoto Game details scroll down to API CONSOLE PROJECT and click your project name




        Check if in api & auth>Credentials> package name is the same as in the developer console



        it must be the same as in developer console if it is not go back and add game services again but this time use I already use GOOGLE APIS in my game button, find your app and add.Check again if it shows up properly this time.


      *you don't need to publish game services to test it with your own account.


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

    使用道具 举报

  • TA的每日心情
    擦汗
    2018-4-10 15:18
  • 签到天数: 447 天

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

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

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

    开源英雄守望者

     楼主| 发表于 2015-4-3 17:11:05 | 显示全部楼层
    ANE-GooglePlayServices


    Adobe AIR ANE Project - this example illustrates a problem, and doesn't work!






    ANE-GooglePlayServices

    Adobe AIR ANE Project - this example illustrates a problem, and doesn't work!

    This Android ANE will work if you comment out the GooglePlayServicesUtils references in this file:

    https://github.com/interactivenyc/ANE-GooglePlayServices/blob/master/SPK-GPS_Java_Eclipse/src/com/speakaboos/ane/gps/testGPS.java

    This project can be built with the ANT script in the SPK-GPS_Build folder. Just navigate to that folder and run "ant buildANE." To build the test GPS.apk file and install it on your Android device, run "ant buildTest." NOTE: You'll need to edit the top of the build.config file to point the script to your FLEX and AIR SDKs, and the location of your local project files.

    The test GPS.apk has three buttons: testGPS, keepAwake and cancelKeepAwake. The keepAwake functions call native Android Java functions, and work as expected. The testGPS button tries to validate the existence of the google-play-services.jar library using this method, which fails:

    1. GooglePlayServicesUtil.isGooglePlayServicesAvailable(context)
    复制代码
    I've tried to make this as simple as possible, in order to ask for help getting it to work. If you have any questions, please email me at [url=mailto:steve+github@speakaboos.com]steve+github@speakaboos.com[/url].There are two different folders for compiling the native JAR file for inclusion in the ANE. I believe the problem lies in the way I'm trying to include the google-play-services.jar file in my project. I've tried including it from the libs folder in the Eclipse version. I've tried combining it with my own jar file. I've tried using AndroidStudio and Gradle to see if their way of including a module would help. I've used a platformoptions file to see if AIR could include the library that way too. I'm out of ideas.'



    相关链接:

    https://github.com/interactivenyc/ANE-GooglePlayServices


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

    使用道具 举报

  • TA的每日心情
    擦汗
    2018-4-10 15:18
  • 签到天数: 447 天

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

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

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

    开源英雄守望者

     楼主| 发表于 2015-4-8 16:32:06 | 显示全部楼层
    ANE-GooglePlayServices

    Shared library including the Google Play Services Library

    https://github.com/distriqt/ANE-GooglePlayServices
    守望者AIR技术交流社区(www.airmyth.com)
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2019-2-24 01:34
  • 签到天数: 3 天

    [LV.2]偶尔看看I

    0

    主题

    38

    帖子

    868

    积分

    上士

    Rank: 5Rank: 5

    威望
    20
    贡献
    0
    金币
    14
    钢镚
    0
    发表于 2017-10-24 03:13:46 | 显示全部楼层
    感谢分享!~
    守望者AIR技术交流社区(www.airmyth.com)
    回复

    使用道具 举报

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

    本版积分规则

    
    关闭

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

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

    GMT+8, 2019-5-24 21:11 , Processed in 0.054189 second(s), 39 queries .

    守望者AIR

    守望者AIR技术交流社区

    本站成立于 2014年12月31日

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