デバイスをクラウドに登録しようとしています(Google Cloud Messaging GCM)
しかし、アプリケーションが直面しているいくつかのエラー
これについて私を助けてくれませんか
これが私のマニフェストです
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test09_gsm"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
<permission android:name="com.example.test09_gsm.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.example.test09_gsme.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.test09_gsm.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name="com.google.android.gcm.GCMBroadcastReceiver" 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="com.example.test09_gsm" />
</intent-filter>
</receiver>
<service android:name=".GCMIntentService" />
</application>
</manifest>
彼女のクラス
package com.example.test09_gsm;
import com.google.android.gcm.GCMBaseIntentService;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
public class GCMIntentService extends GCMBaseIntentService {
public static String TAG = "GCMIntentService";
public GCMIntentService(String senderId)
{
super(senderId);
Log.d("GCMIntentService", senderId);
}
@Override
protected void onError(Context arg0, String arg1) {
Log.d("onError", arg1);
}
@Override
protected boolean onRecoverableError(Context context, String errorId){
Log.d("onRecoverableError", errorId);
return false;
}
@Override
protected void onMessage(Context arg0, Intent arg1) {
Log.d("onMessage", String.valueOf(arg1));
}
@Override
protected void onRegistered(Context arg0, String arg1) {
Log.d("onRegistered", arg1);
}
@Override
protected void onUnregistered(Context arg0, String arg1) {
Log.d("onUnregistered", arg1);
}
}
主な活動
package com.example.test09_gsm;
import com.google.android.gcm.GCMRegistrar;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
final String regId = GCMRegistrar.getRegistrationId(this);
if (regId.equals(""))
{
GCMRegistrar.register(this, "XXXXXXXXXXXX");
}
else
{
Log.v("Info : ", "Already registered");
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
LogCat
12-15 00:28:28.935: E/Trace(4569): error opening trace file: No such file or directory (2)
12-15 00:28:29.085: D/GCMRegistrar(4569): resetting backoff for com.example.test09_gsm
12-15 00:28:29.085: V/GCMRegistrar(4569): Registering app com.example.test09_gsm of senders XXXXXXXXXXXX
12-15 00:28:29.160: D/libEGL(4569): loaded /system/lib/egl/libEGL_mali.so
12-15 00:28:29.165: D/libEGL(4569): loaded /system/lib/egl/libGLESv1_CM_mali.so
12-15 00:28:29.165: D/libEGL(4569): loaded /system/lib/egl/libGLESv2_mali.so
12-15 00:28:29.170: D/(4569): Device driver API match
12-15 00:28:29.170: D/(4569): Device driver API version: 10
12-15 00:28:29.170: D/(4569): User space API version: 10
12-15 00:28:29.170: D/(4569): mali: REVISION=Linux-r2p4-02rel0 BUILD_DATE=Wed Sep 12 17:53:53 KST 2012
12-15 00:28:29.205: D/OpenGLRenderer(4569): Enabling debug mode 0
12-15 00:28:29.985: V/GCMBroadcastReceiver(4569): onReceive: com.google.android.c2dm.intent.REGISTRATION
12-15 00:28:29.985: V/GCMBroadcastReceiver(4569): GCM IntentService class: com.example.test09_gsm.GCMIntentService
12-15 00:28:29.985: V/GCMBaseIntentService(4569): Acquiring wakelock
12-15 00:28:30.000: D/dalvikvm(4569): newInstance failed: no <init>()
12-15 00:28:30.000: D/AndroidRuntime(4569): Shutting down VM
12-15 00:28:30.000: W/dalvikvm(4569): threadid=1: thread exiting with uncaught exception (group=0x40e372a0)
12-15 00:28:30.000: E/AndroidRuntime(4569): FATAL EXCEPTION: main
12-15 00:28:30.000: E/AndroidRuntime(4569): java.lang.RuntimeException: Unable to instantiate service com.example.test09_gsm.GCMIntentService: java.lang.InstantiationException: can't instantiate class com.example.test09_gsm.GCMIntentService; no empty constructor
12-15 00:28:30.000: E/AndroidRuntime(4569): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2388)
12-15 00:28:30.000: E/AndroidRuntime(4569): at android.app.ActivityThread.access$1600(ActivityThread.java:140)
12-15 00:28:30.000: E/AndroidRuntime(4569): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1309)
12-15 00:28:30.000: E/AndroidRuntime(4569): at android.os.Handler.dispatchMessage(Handler.java:99)
12-15 00:28:30.000: E/AndroidRuntime(4569): at android.os.Looper.loop(Looper.java:137)
12-15 00:28:30.000: E/AndroidRuntime(4569): at android.app.ActivityThread.main(ActivityThread.java:4898)
12-15 00:28:30.000: E/AndroidRuntime(4569): at java.lang.reflect.Method.invokeNative(Native Method)
12-15 00:28:30.000: E/AndroidRuntime(4569): at java.lang.reflect.Method.invoke(Method.java:511)
12-15 00:28:30.000: E/AndroidRuntime(4569): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
12-15 00:28:30.000: E/AndroidRuntime(4569): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
12-15 00:28:30.000: E/AndroidRuntime(4569): at dalvik.system.NativeStart.main(Native Method)
12-15 00:28:30.000: E/AndroidRuntime(4569): Caused by: java.lang.InstantiationException: can't instantiate class com.example.test09_gsm.GCMIntentService; no empty constructor
12-15 00:28:30.000: E/AndroidRuntime(4569): at java.lang.Class.newInstanceImpl(Native Method)
12-15 00:28:30.000: E/AndroidRuntime(4569): at java.lang.Class.newInstance(Class.java:1319)
12-15 00:28:30.000: E/AndroidRuntime(4569): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2385)
12-15 00:28:30.000: E/AndroidRuntime(4569): ... 10 more
この問題を解決して登録IDを受け取り、それを使用するにはどうすればよいですか?
前もって感謝します