2012-01-09 10 views
1

ライブ壁紙を作成しました。設定メニューで私はadmobを追加しました。それはちょうど良い広告を読み込みます。 私はこのチュートリアルhttp://irinaramazova.blogspot.com/2011/09/add-admob-adview-to-preferenceactivity.htmlを使用しました。(ライブ壁紙設定のアクティビティで)admobがクリックされるとクラッシュします

しかし、私が広告をクリックしたとき、それは私にこれはこれは設定live_wallpaperであるマニフェストファイル -

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="ca.jvsh.livewallpaper" 
    android:versionName="1.0.20100908.1" 
    android:versionCode="1"> 

    <uses-sdk android:minSdkVersion="7" /> 
    <uses-feature android:name="android.software.live_wallpaper" /> 

    <uses-permission android:name="android.permission.INTERNET"/> 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 
    <uses-permission android:name="android.permission.BIND_WALLPAPER" /> 




    <application android:icon="@drawable/icon" 
     android:label="@string/app_name"> 

     <service android:name=".LiveWallpaper" 
      android:label="@string/app_name" 
      android:icon="@drawable/icon" 
      android:permission="android.permission.BIND_WALLPAPER"> 

      <intent-filter> 
       <action android:name="android.service.wallpaper.WallpaperService" /> 
      </intent-filter> 
      <meta-data android:name="android.service.wallpaper" 
       android:resource="@xml/livewallpaper" /> 

     </service> 

     <activity android:label="@string/livewallpaper_settings" 
      android:name=".LiveWallpaperSettings" 
      android:exported="true" 
      android:icon="@drawable/icon" 
      android:permission="android.permission.BIND_WALLPAPER"> 

      <intent-filter> 
       <action android:name="android.intent.action.MAIN"> 
       </action> 
      </intent-filter> 


     </activity> 

     <activity android:name="com.google.ads.AdActivity" 
      android:permission="android.permission.BIND_WALLPAPER" 
       android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"> 
     </activity> 

    </application> 


</manifest> 

ある

01-09 14:07:25.098: E/AndroidRuntime(3907): FATAL EXCEPTION: main 
01-09 14:07:25.098: E/AndroidRuntime(3907): java.lang.SecurityException: Permission Denial: starting Intent { cmp=ca.jvsh.livewallpaper/com.google.ads.AdActivity (has extras) } from ProcessRecord{2b3b5a38 3907:ca.jvsh.livewallpaper/10137} (pid=3907, uid=10137) requires android.permission.BIND_WALLPAPER 
01-09 14:07:25.098: E/AndroidRuntime(3907):  at android.os.Parcel.readException(Parcel.java:1322) 
01-09 14:07:25.098: E/AndroidRuntime(3907):  at android.os.Parcel.readException(Parcel.java:1276) 
01-09 14:07:25.098: E/AndroidRuntime(3907):  at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1351) 
01-09 14:07:25.098: E/AndroidRuntime(3907):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1374) 
01-09 14:07:25.098: E/AndroidRuntime(3907):  at android.app.Activity.startActivityForResult(Activity.java:2827) 
01-09 14:07:25.098: E/AndroidRuntime(3907):  at android.app.Activity.startActivity(Activity.java:2933) 
01-09 14:07:25.098: E/AndroidRuntime(3907):  at com.google.ads.AdActivity.launchAdActivity(SourceFile:257) 
01-09 14:07:25.098: E/AndroidRuntime(3907):  at com.google.ads.i.shouldOverrideUrlLoading(SourceFile:134) 
01-09 14:07:25.098: E/AndroidRuntime(3907):  at android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:224) 
01-09 14:07:25.098: E/AndroidRuntime(3907):  at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:331) 
01-09 14:07:25.098: E/AndroidRuntime(3907):  at android.os.Handler.dispatchMessage(Handler.java:99) 
01-09 14:07:25.098: E/AndroidRuntime(3907):  at android.os.Looper.loop(Looper.java:130) 
01-09 14:07:25.098: E/AndroidRuntime(3907):  at android.app.ActivityThread.main(ActivityThread.java:3701) 
01-09 14:07:25.098: E/AndroidRuntime(3907):  at java.lang.reflect.Method.invokeNative(Native Method) 
01-09 14:07:25.098: E/AndroidRuntime(3907):  at java.lang.reflect.Method.invoke(Method.java:507) 
01-09 14:07:25.098: E/AndroidRuntime(3907):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) 
01-09 14:07:25.098: E/AndroidRuntime(3907):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624) 
01-09 14:07:25.098: E/AndroidRuntime(3907):  at dalvik.system.NativeStart.main(Native Method) 

saying-セキュリティ例外を与えるファイル -

<?xml version="1.0" encoding="utf-8"?> 
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" 
    android:title="@string/livewallpaper_settings" 
    android:key="livewallpaper_settings"> 

    <ca.jvsh.livewallpaper.AdmobPreference android:key="adView"> 
    </ca.jvsh.livewallpaper.AdmobPreference> 

    <ListPreference 
     android:key="livewallpaper_background" 
     android:title="@string/livewallpaper_background_title" 
     android:summary="@string/livewallpaper_background_summary" 
     android:entries="@array/livewallpaper_background_names" 
     android:entryValues="@array/livewallpaper_background_prefix"/> 
    <ListPreference 
     android:key="livewallpaper_no_of_balloons" 
     android:title="@string/livewallpaper_no_of_balloons_title" 
     android:summary="@string/livewallpaper_no_of_balloons_summary" 
     android:entries="@array/livewallpaper_no_of_balloons_names" 
     android:entryValues="@array/livewallpaper_no_of_balloons_prefix"/> 
    <CheckBoxPreference android:key="livewallpaper_shake" 
     android:summary="@string/livewallpaper_shake_summary" 
     android:title="@string/livewallpaper_shake_title" 
     android:summaryOn="Balloons fall when the phone is shaked" 
     android:summaryOff="Balloons fall from the top continously"/> 
</PreferenceScreen> 

これは優先クラスです。

package ca.jvsh.livewallpaper; 

import android.content.Context; 
import android.preference.Preference; 
import android.util.AttributeSet; 
import android.view.LayoutInflater; 
import android.view.View; 
import android.view.ViewGroup; 

public class AdmobPreference extends Preference 
{ 
    public AdmobPreference(Context context) { 
     super(context, null); 
    } 

    public AdmobPreference(Context context, AttributeSet attrs) { 
     super(context, attrs); 
    } 

    @Override 
    protected View onCreateView(ViewGroup parent) { 
     LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
     return inflater.inflate(R.layout.admob_preference, null); 
    } 

} 
+0

SOLVED- REMOVED 'アンドロイド:許可= "android.permission.BIND_WALLPAPER"' 'FROM <活動のアンドロイド:名= "com.google.ads.AdActivity" アンドロイド:許可=" android.permission。 BIND_WALLPAPER "android:configChanges =" keyboard | keyboardHidden | orientation | screenLayout | uiMode | screenSize | smallestScreenSize "> ' – sifat

答えて