简体   繁体   中英

GCM Push Notification adobe air

I m developing a push notification service for my app in android i came to some tutorials to achieve my goal. I struck to 2 things that i can't figure out. I need some help.

  • PushNotifications.init( "*DEV_KE*Y" );
  • <permission android:name="*application ID*.permission.C2D_MESSAGE"

Now i want to know about this 2 things. Dev_key and application id.Secondly is PushNotifications.init(); necessary to call? what if i call it without dev_key param?

I'm guessing you're following the tutorials on distriqt's site about using the distriqt cross platform push notifications extension?

If so then the DEV_KEY is actually the developer key you get when you sign up to the distriqt extension package. It is necessary to call this function with a valid key if you are hoping to use the distriqt extensions. If you call it without the DEV_KEY param the extension will not work as documented.

The second line you have there containing the application ID is used in your application descriptor file. You need to add the following to your manifest additions on android replacing all the YOUR_APPLICATION_ID references with your applications id. This is normally of the form : com.company.name. The air prefixes are shown as these are your applications full id on the Android platform.

<android>
    <manifestAdditions><![CDATA[
        <manifest android:installLocation="auto">

            <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16"/>

            <uses-permission android:name="android.permission.INTERNET"/>
            <uses-permission android:name="android.permission.GET_ACCOUNTS" />
            <uses-permission android:name="android.permission.VIBRATE"/>
            <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.YOUR_APPLICATION_ID.permission.C2D_MESSAGE" android:protectionLevel="signature" />
            <uses-permission android:name="air.YOUR_APPLICATION_ID.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.YOUR_APPLICATION_ID" />
                    </intent-filter>
                </receiver>
                <service android:enabled="true" android:exported="true" android:name="com.distriqt.extension.pushnotifications.gcm.GCMIntentService" />
            </application>

        </manifest>

    ]]></manifestAdditions>
</android>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM