2011-11-09 16 views
1

私のアプリは、登録プロセス中にクラッシュします。私はこれに対して多くの可能な修正を試みましたが、希望はありません。サーバー側でPHPを使用しました。助けてください、以下は私が追加したコードですそれ。C2DM登録プロセスでアプリがクラッシュすることはありませんか?

1.In the Main Activity 

C2DMessaging.register(this、 "[email protected]");

{

パブリック静的ボイドレジスタ(コンテキスト・コンテキスト、文字列のSenderID)

C2DMessagingクラス2.In意図registrationIntent =新しいテント(REQUEST_REGISTRATION_INTENT)。

registrationIntent.setPackage(GSF_PACKAGE); 
    registrationIntent.putExtra(EXTRA_APPLICATION_PENDING_INTENT,PendingIntent.getBroadcast(context, 0, new Intent(), 0)); 

    registrationIntent.putExtra(EXTRA_SENDER, senderId); 
    context.startService(registrationIntent); 
    // TODO: if intent not found, notification on need to have GSF 
}  

私のマニフェストファイルには、私は私がすべての可能なメートルを試してみましたが、この中に行方不明です何かわからない

<?xml version="1.0" encoding="utf-8"?> 

<uses-permission android:name="com.requestec.push.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.READ_PHONE_STATE"/> 
<uses-permission android:name="android.permission.WAKE_LOCK" /> 
<uses-permission android:name="android.permission.GET_ACCOUNTS" /> 
<uses-permission android:name="android.permission.USE_CREDENTIALS" /> 

<application android:icon="@drawable/icon" android:label="@string/app_name"> 
    <activity android:name="com.notify.AndroidNotification" 
       android:label="@string/app_name"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 

    <service android:name=".C2DMReceiver" android:enabled="true" /> 
    <receiver android:name="com.google.android.c2dm.C2DMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND"> 
    <intent-filter> 
      <action android:name="com.google.android.c2dm.intent.RECEIVE" /> 
      <category android:name="com.kk.push" /> 
     </intent-filter> 
     <!-- Receive registration ids --> 
     <intent-filter> 
      <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> 
      <category android:name="com.kk.push" /> 
     </intent-filter> 

    </receiver> 

</application> 

です私はここで何か基本的なものが欠けています。ありがとう

+0

あなたは含めることができますあなたが持っているエラーメッセージ(DDMSを使用して)? –

+0

ご回答いただきありがとうございます。私は11-10を取得しました。15:29:50.443:WARN/ActivityManager(59):許可の否認:インテント{act = com.google.android.c2dm.intent.REGISTRATION cat = [com.kk com.kk.pushに送信者com.google.android.gsf(uid 10023) – Karthik

+0

のためにcom.kk.push.permission.C2D_MESSAGEが必要です。また、11-10 16:01:07.353: ERROR/C2DMRegistrar(188):[C2DMReg] handleRequest catch java.io.IOException:SSLシャットダウンに失敗しました:システムコール中に入出力エラーが発生しました。 – Karthik

答えて

2

あなたに許可の問題があるようです。

あなたの主な活動は、Main.javaと呼ばれ、あなたは(、C2DMBaseReceiver拡張のonErrorとのonMessageを扱う)クラスC2DMReceiverを持っていると仮定すると、あなたのAndroidManifestは次のようになります。

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.kk.push" android:versionCode="1" 
android:versionName="1.0"> 
<uses-sdk android:minSdkVersion="8" /> 

<permission 
    android:name="com.kk.push.permission.C2D_MESSAGE" 
    android:protectionLevel="signature" /> 
<uses-permission 
    android:name="com.kk.push.permission.C2D_MESSAGE" /> 

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

<application android:icon="@drawable/icon" android:label="@string/app_name"> 
    <activity android:name=".Main" 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=".C2DMReceiver" 
     android:permission="com.google.android.c2dm.permission.SEND"> 
     <intent-filter> 
      <action android:name="com.google.android.c2dm.intent.REGISTRATION"></action> 
      <category android:name="com.kk.push" /> 
     </intent-filter> 

    </receiver> 

</application> 

関連する問題