由网友(爺的範兒妳學不來)分享简介:我想用下面的code到注册设备到GCM:I am trying to register a device onto GCM using the following code:public void onCreate(Bundle savedInstanceState) {super.onCreate(savedIns...
我想用下面的code到注册设备到GCM:
I am trying to register a device onto GCM using the following code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
GCMRegistrar.checkDevice(this);
// the following function can be removed when deploying the app
GCMRegistrar.checkManifest(this);
final String regId = GCMRegistrar.getRegistrationId(this);
if (regId.equals("")) {
GCMRegistrar.register(this, SENDER_ID);
} else {
Log.v(TAG, "Already registered");
}
我已经导入进口com.google.android.gcm.GCMRegistrar; 还增加GCM.jar我在Eclipse构建路径,我得到了直通的SDK下载
I have imported import com.google.android.gcm.GCMRegistrar; and also added GCM.jar to my buildpath in Eclipse which i got thru the sdk download
请帮忙!
推荐答案
在更新ADT(以上ADT 17)你必须把jar文件里面的库
文件夹,而不是 LIB
。因此,请确保你把 gcm.jar
在库文件
,而不是 LIB
文件夹。
In the updated ADT(Above ADT 17) you have to put jar files inside libs
folder and not lib
. So make sure that you put gcm.jar
file inside libs
and not lib
folder.
相关推荐
最新文章