I am trying to set up the sample project for Worklight push notification on Android. When I launch the app in the Android emulator only the first two buttons (isSubscribed and isSupported) are clickable. The other two buttons (Subscribe and Unsubscribe) remain disabled.
我正在尝试在Android上建立Worklight push notification的样例项目。当我在Android模拟器中启动应用程序时,只有前两个按钮(订阅和支持)是可点击的。其他两个按钮(订阅和取消订阅)仍然被禁用。
My steps are:
我的步骤是:
- Import the project into Eclipse
- 将项目导入Eclipse。
- Replace the SenderID and API Keys with the one obtains from GCM Console in application-descriptor.xml
- 将SenderID和API键替换为应用程序描述符.xml中从GCM控制台获取的键
- Deploy the PushAdapter (included in the project)
- 部署PushAdapter(包含在项目中)
- Build and deploy
- 构建和部署
- Launch the Android application in the emulator
- 在模拟器中启动Android应用程序
What is missing?
缺少的是什么?
1 个解决方案
#1
3
For Push Notifications to work in the Android Emulator, you need to make sure to install in the Android SDK Manager:
要让推送通知在Android模拟器中工作,需要在Android SDK管理器中安装:
-
The Google APIs add-on corresponding to the API Level you're using for your project (in Worklight it must be API Level 8 or above). The AVD you create should use this Google API
与项目使用的API级别相对应的谷歌API扩展(在Worklight中,它必须是API级别8或更高)。您创建的AVD应该使用这个谷歌API
-
The Google Cloud Messaging for Android Library (available in the Extras category)
用于Android库的谷歌云消息传递(可在Extras类别中获得)
Note: Push Notifications in the Android Emulator work only in an AVD running Android OS 4.x.x.
注意:Android模拟器中的推送通知只能在运行Android OS 4.x的AVD中使用。
Next, you need to set-up GCM:
These steps are relevant whether you're using a device or emulator.
接下来,您需要设置GCM:无论您使用的是设备还是模拟器,这些步骤都是相关的。
- Create a Gmail email address
- 创建一个Gmail电子邮件地址
- Go to GCM's web page: http://developer.android.com/google/gcm/gs.html
- 进入GCM的网页:http://developer.android.com/google/gcm/gs.html
- Click on "Google APIs Console page"
- 点击“谷歌api控制台页面”
- If you have never done step 3 above, you will be asked to create a project, this project will have an ID. This ID is the
senderId
value you place in application-descriptor.xml - 如果您还没有完成上面的步骤3,您将被要求创建一个项目,这个项目将具有一个ID,这个ID是您在application-descriptor.xml中放置的senderId值
- Click on "Create new Server key..." / "Create new Android key"
- 点击“创建新的服务器密钥…”/“创建新的Android key”
- The generated key is the
API key
value you place in application-descriptor.xml - 生成的键是您在应用程序描述符.xml中放置的API键值
Now you need to:
现在,您需要:
- Build and deploy the application
- 构建和部署应用程序
- Deploy the adapter
- 部署适配器
- Run the app on a device or emulator
- 在设备或模拟器上运行应用程序
#1
3
For Push Notifications to work in the Android Emulator, you need to make sure to install in the Android SDK Manager:
要让推送通知在Android模拟器中工作,需要在Android SDK管理器中安装:
-
The Google APIs add-on corresponding to the API Level you're using for your project (in Worklight it must be API Level 8 or above). The AVD you create should use this Google API
与项目使用的API级别相对应的谷歌API扩展(在Worklight中,它必须是API级别8或更高)。您创建的AVD应该使用这个谷歌API
-
The Google Cloud Messaging for Android Library (available in the Extras category)
用于Android库的谷歌云消息传递(可在Extras类别中获得)
Note: Push Notifications in the Android Emulator work only in an AVD running Android OS 4.x.x.
注意:Android模拟器中的推送通知只能在运行Android OS 4.x的AVD中使用。
Next, you need to set-up GCM:
These steps are relevant whether you're using a device or emulator.
接下来,您需要设置GCM:无论您使用的是设备还是模拟器,这些步骤都是相关的。
- Create a Gmail email address
- 创建一个Gmail电子邮件地址
- Go to GCM's web page: http://developer.android.com/google/gcm/gs.html
- 进入GCM的网页:http://developer.android.com/google/gcm/gs.html
- Click on "Google APIs Console page"
- 点击“谷歌api控制台页面”
- If you have never done step 3 above, you will be asked to create a project, this project will have an ID. This ID is the
senderId
value you place in application-descriptor.xml - 如果您还没有完成上面的步骤3,您将被要求创建一个项目,这个项目将具有一个ID,这个ID是您在application-descriptor.xml中放置的senderId值
- Click on "Create new Server key..." / "Create new Android key"
- 点击“创建新的服务器密钥…”/“创建新的Android key”
- The generated key is the
API key
value you place in application-descriptor.xml - 生成的键是您在应用程序描述符.xml中放置的API键值
Now you need to:
现在,您需要:
- Build and deploy the application
- 构建和部署应用程序
- Deploy the adapter
- 部署适配器
- Run the app on a device or emulator
- 在设备或模拟器上运行应用程序