本文介绍了AIR本机扩展无法启动服务意向的Andr​​oid GCM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿大家我一直在玩弄周围的原生扩展最近针对Android,我需要添加谷歌云消息传递。我能够得到谷歌云消息传递应用程序的工作自己。但现在,我已经将它纳入原生扩展的闪存,我发现一个问题,我解决不了。

Hey everyone I have been toying around with a native extension lately for Android and I need to add Google Cloud Messaging. I was able to get the Google Cloud Messaging app to work on its own. But now that I have integrated it into a native extension for Flash I have found an issue I can't resolve.

08-21 17:58:01.661: W/ActivityManager(180): Unable to start service Intent { act=com.google.android.c2dm.intent.REGISTRATION cat=[air.GCMAppTest.debug] flg=0x10 cmp=air.GCMAppTest.debug/com.xxxxxxxxx.extensions.GCM.GCMIntentService (has extras) }: not found

此错误出现时,GCM广播接收器接收

This error comes up when the GCM Broadcast Receiver receives the

08-21 17:58:01.661: V/GCMBroadcastReceiver(7604): GCM IntentService class: com.gamecloudstudios.popsportsandroidane.extensions.GCM.GCMIntentService

该错误是由Flash包上下文是默认的包引起的。当我需要的默认包是包含GCMIntentService包。

The error is caused by the Flash Package Context being the default package.When I need the default package to be the package containing the GCMIntentService.

有没有人能够得到的GCMIntentService在一个Android的Flash本机扩展运行?或任何AndroidIntentService的这一问题。

Has anyone been able to get the GCMIntentService to run in an Android Flash Native Extension? or any AndroidIntentService for that matter.

推荐答案

您需要确保您添加的意向服务到您的AIR应用程序描述,你的原生code库不是Android清单的明显增加。例如,下面的code是我们在我们的例子中,我们GCM原生扩展可以在这里找到,如果你有兴趣。

You need to make sure you add the Intent Service to the manifest additions of your AIR application descriptor, not the Android manifest of your native code library. For example, the following code is what we use in our example application of our GCM native extension available here if you're interested.

有几件事情要注意在那里,特别是空气。 preFIX上的一些Android的名称。但只要你拥有所有这些附加,了Android code中的实际执行应该是相当类似谷歌的例子。

There are a few things to note in there, especially the "air." prefix on some of the android names. But as long as you have all these additions, the actual implementation of the Android code should be fairly similar to the Google examples.

<android>
    <manifestAdditions><![CDATA[
        <manifest android:installLocation="auto">
            <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8"/>

            <uses-permission android:name="android.permission.INTERNET"/>
            <uses-permission android:name="android.permission.GET_ACCOUNTS" />
            <uses-permission android:name="android.permission.WAKE_LOCK" />
            <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

            <!-- Only this application can receive the messages and registration result -->
            <permission android:name="air.com.distriqt.test.debug.permission.C2D_MESSAGE" android:protectionLevel="signature" />
            <uses-permission android:name="air.com.distriqt.test.debug.permission.C2D_MESSAGE" />

            <application>
                <receiver android:enabled="true" android:exported="true" android:name="com.distriqt.extension.pushnotifications.PushNotificationsBroadcastReceiver" 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.com.distriqt.test.debug" />
                    </intent-filter>
                </receiver>
                <service android:enabled="true" android:exported="true" android:name="com.distriqt.extension.pushnotifications.gcm.GCMIntentService" />

            </application>
        </manifest>

    ]]></manifestAdditions>
</android>

这篇关于AIR本机扩展无法启动服务意向的Andr​​oid GCM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 17:02