AdMob still not working - android

I got a problem regarding Google AdMob:
I try to display a Interstitial, for this I have added the AdActivity, permissions and meta-tags to manifest.
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.lunation.warface"
android:versionCode="10"
android:versionName="1.4" >
<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:largeHeap="true"
android:theme="#style/AppTheme"
android:windowSoftInputMode="adjustPan|adjustResize" >
<!--This meta-data tag is required to use Google Play Services.-->
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<!--Include the AdActivity configChanges and theme. -->
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="#android:style/Theme.Translucent" />
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:screenOrientation="sensorPortrait"
android:windowSoftInputMode="adjustPan|adjustResize" >
<intent-filter>
</intent-filter>
</activity>
<activity
android:name=".SplashScreen"
android:noHistory="true"
android:screenOrientation="sensorPortrait"
android:theme="#style/Theme.Transparent" >
<intent-filter>
<action android:name="android.intent.action.MAIN" >
</action>
<category android:name="android.intent.category.LAUNCHER" >
</category>
</intent-filter>
</activity>
<activity android:name="gallery.FullScreenViewActivity"></activity>
</application>
</manifest>
In MainActivity:
mInterstitialAd = new InterstitialAd(this);
mInterstitialAd.setAdUnitId("xxx/xxx");
AdRequest adRequest = new AdRequest.Builder().build();
mInterstitialAd.loadAd(adRequest);
if (mInterstitialAd != null && mInterstitialAd.isLoaded()) {
mInterstitialAd.show();
}
Logcat:
04-04 15:15:19.397: W/Ads(19752): There was a problem getting an ad response. ErrorCode: 0
04-04 15:15:19.407: I/dalvikvm(19752): Could not find method android.webkit.WebSettings.setMixedContentMode, referenced from method com.google.android.gms.ads.internal.s.g.<init>
04-04 15:15:19.407: W/dalvikvm(19752): VFY: unable to resolve virtual method 3153: Landroid/webkit/WebSettings;.setMixedContentMode (I)V
04-04 15:15:19.407: D/dalvikvm(19752): VFY: replacing opcode 0x6e at 0x004a
04-04 15:15:19.502: W/Ads(19752): Failed to load ad: 0
Besides there is also a compilation error:
Conversion of dalvik format failed with error code 1
I tried about 20 answers, still not working.
I also dont know whether the problem is the unit id, I can change
mInterstitialAd.setAdUnitId("xxx/xxx");
to:
mInterstitialAd.setAdUnitId("xxx");
and I got the same errors.
I use the following external libraries:
android support v4&v7, picasso, ftpclient(commons, httpmime),FAB
Does somebody have a advice?
Greetings

Solution found!
Seems like some features in CyanogenMod blocks AdMob.
Flashed a new version WITHOUT Adaware and blocking Tools.
WORKING NOW :D

Related

Cause of Error Message "Error:(27) Tag <manifest> attribute package has invalid type 4."

When trying to build my app, I get the following error message: "Error:(27) Tag <manifest> attribute package has invalid type 4." Any ideas on what is causing this? Here is a copy of my manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dummy.tanc">
<application
android:supportsRtl="true"
android:allowBackup="true"
android:fullBackupContent="false"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="#string/app_id" />
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version"/>
<activity
android:name="com.google.example.games.tanc.MainActivity"
android:label="#string/title_activity_main"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I think it is because, in your manifest, you've set your package name (line 2) to be
package="com.dummy.tanc"
and in when defining the activity (line 18), you've used
android:name="com.google.example.games.tanc.MainActivity"
Because of this mismatch, the issue could be arising. Change the line 18 to
android:name="com.dummy.tanc.MainActivity"
It means attribute package has type float but not string.
I guess your package name contains only numbers, something like package="1.0".

ACRA not sending to eMail

I am trying to send crash reports to email but when my app crashes nothing happens. I tried messing around with configurations but i just kept getting errors (unknown member mostly, wth that is). Here's my code for the class.
#ReportsCrashes(
mailTo = "me#gmail.com")
public class MyApplication extends Application
{
#Override
public void onCreate() {
super.onCreate();
// The following line triggers the initialization of ACRA
ACRA.init(this);
}
}
My manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ghostdevelopment.ueni2"
android:versionCode="1"
android:versionName="1.0"
android:debuggable="true">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="25" />
<application
android:name="MyApplication"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:label="#string/app_name"
android:name="com.ghostdevelopment.ueni2.MainActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:label="Ship Database"
android:name=".ShipInfo" />
</application>
</manifest>
According to your logcat it appears that your app has not included the ACRA library. You need to configure your build so that ACRA is included in your APK.

Permission Denied

My app is crashing when I call insert on the contentProvider class and I get a permission denied error. How do I set the permission??
01-13 23:41:15.071 467-467/system_process W/ActivityManager﹕ Permission denied: checkComponentPermission() owningUid=10065
01-13 23:41:15.071 467-467/system_process W/ActivityManager﹕ Permission Denial: opening provider net.kritico.todolist.ToDoContentProvider from ProcessRecord{a784a9c0 1669:net.kritico.kriticoads/u0a10069} (pid=1669, uid=10069) that is not exported from uid 10065
My manifest is as below
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="18" />
<!-- Used to request banner and interstitial ads. -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Used to avoid sending an ad request if there is no connectivity. -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="net.kritico.kriticoads.MainActivity"
android:label="#string/app_name"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Activity required to show ad overlays. -->
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|
screenSize|s mallestScreenSize" />
<activity
android:name="net.kritico.kriticoads.ToDoItemActivity"
android:label="#string/title_activity_to_do_item" >
</activity>
</application>
</manifest>
You need to declare the ContentProvider to your manifest inside of your application tag. Declaring Content Provider
Also see Declaring Content Provider

Intent can't switch between activities-Android 4.0

This is a weird problem, My intent can't switch between activities in case of Android 4.0+ devices, However, on devices with android 2.2/2.3 it works fine.
This is how I define the intent for my class PhotoActivity.
public static final void startActivityForResult(Activity parent, int requestCode, String userName, String photoUrl, Bitmap preview, boolean isMugshot) {
System.out.println("photoactivity started" +requestCode+"second"+parent);
Intent intent = new Intent(parent, PhotoActivity.class)
.putExtra(USERNAME, userName)
.putExtra(PHOTOURL, photoUrl)
.putExtra(PREVIEW, preview)
.putExtra(IS_MUGSHOT, isMugshot);
parent.startActivityForResult(intent, requestCode);
}
I want to switch to this activity class as above from another class upon a particular user touch response. I define this as follows
case R.id.ImgAvatar:
PhotoActivity.startActivityForResult(this, REQUEST_SHOW_AVATOR, mUserName, avatarUrl, mAvatar, true);
break;
My code is fine since in case of android 2.3/2.2 , I can switch in between the actvities. However, while using devices with android 4.0+, Rather than switching between activities upon touch response, I am reverted back to my main activity(clueless why).
I also noticed the console output was different in both 2.2 and 4.0 version. I am still not able to guess why android 4.0 is causing trouble.
This is the log when the activity starts correctly (android 2.2/2.3),
04-11 10:29:21.665: I/System.out(924): photoactivity started userdhttp://www.l-somewhere.com/media/Users/a6cb0167255045a9a2a16bb3411bc2/Mugshot/324c3a02b252428b8676e42671e392c2.jpg
04-11 10:29:21.675: I/System.out(924): photoactivity started4096secondcom.lsomewhere.android.UserDataActivity#44ae2b80
04-11 10:29:21.845: D/dalvikvm(924): GC_EXTERNAL_ALLOC freed 1481 objects / 289856 bytes in 84ms
04-11 10:29:21.855: I/PhotoActivity(924): onCreate// **rightly called** ,switch of activity
04-11 10:29:21.855: I/pthread(924): ## thread 924 is creating thread #dalvik/vm/Thread.c:1443
04-11 10:29:21.855: I/pthread(924): ## thread 1008 is created success
04-11 10:29:25.325: D/dalvikvm(938): GC_FOR_MALLOC freed 1339 objects / 483712 bytes in 69ms
This is the log in case of android 4.0+
04-11 10:34:47.415: I/System.out(22717): photoactivity started userdhttp://www.l-somewhere.com/media/Users/a6cb0167255045a9a2a16bb3411bc2/Mugshot/324c3a02b252428b8676e42671e392c2.jpg
04-11 10:34:47.420: I/System.out(22717): photoactivity started4096secondcom.lsomewhere.android.UserDataActivity#424d6db0
04-11 10:34:47.520: D/SensorManager(22717): unregisterListener:: Listener= android.view.OrientationEventListener$SensorEventListenerImpl#4201ce20
04-11 10:34:47.525: D/Sensors(22717): Remain listener = Sending .. normal delay 200ms
04-11 10:34:47.525: I/Sensors(22717): sendDelay --- 200000000
04-11 10:34:47.525: D/SensorManager(22717): JNI - sendDelay
04-11 10:34:47.525: I/SensorManager(22717): Set normal delay = true
04-11 10:34:47.745: D/dalvikvm(24379): GC_CONCURRENT freed 184K, 10% free 12467K/13703K, paused 3ms+12ms, total 29ms
04-11 10:34:47.750: W/CursorWrapperInner(24379): Cursor finalized without prior close()
04-11 10:34:47.775: I/MainActivity(24379): RegistrationId, DeviceTocken: //**I don't know why rather than starting the photo activity, the main activity is called,**
Clearly, in case of android 4.0+ , my second activity is not called and i am reverted back to main activity. Another interesting observation is that the intent is actually called, i.e. I reach the function where I define the intent, but It seems like intent cannot start the activity, so the intent does run but It can't start the new activity. I am clueless since my code is not giving any run/compile time errors making it difficult to find out the problem. Appreciate the help.
Here is my Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.lsomewhere.android"
android:versionCode="37"
android:versionName="1.0.37" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<permission
android:name="com.lsomewhere.android.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.lsomewhere.android.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" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<application
android:icon="#drawable/ic_launcher_72x72"
android:label="#string/app_name" >
<uses-library
android:name="com.google.android.maps"
android:required="true" />
<service
android:name=".LsCommService"
android:process=":apisrv" >
<intent-filter>
<action android:name="com.lsomewhere.android.LSAPISERVICE" />
</intent-filter>
</service>
<service android:name=".GCMIntentService" />
<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.lsomewhere.android" />
</intent-filter>
</receiver>
<activity
android:name=".SplashActivity"
android:configChanges="keyboardHidden|orientation"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".LoginActivity"
android:configChanges="keyboardHidden|orientation"
android:label="#string/login"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar"
android:windowSoftInputMode="stateUnspecified|adjustPan" >
</activity>
<activity
android:name=".ProfileActivity"
android:configChanges="keyboardHidden|orientation"
android:label="#string/login"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar" >
</activity>
<activity
android:name=".AvatarActivity"
android:configChanges="keyboardHidden|orientation"
android:label="#string/upload_your_photo"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar" >
</activity>
<activity
android:name=".MainActivity"
android:configChanges="keyboardHidden|orientation"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".UserDataActivity"
android:configChanges="keyboardHidden|orientation"
android:label="#string/user_data"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar"
android:windowSoftInputMode="stateHidden" >
</activity>
<activity
android:name=".GalleryActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar"
>
</activity>
<activity
android:name=".PhotoActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar"
>
</activity>
<activity
android:name=".PasswordActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar"
android:windowSoftInputMode="stateVisible" >
</activity>
<activity
android:name=".AboutActivity"
android:configChanges="keyboardHidden|orientation"
android:theme="#android:style/Theme.Black.NoTitleBar" >
</activity>
<activity
android:name=".AdvrDataActivity"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar" >
</activity>
<activity
android:name=".PageBase"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar" >
</activity>
<activity android:name="com.lsomewhere.android.TutorialActivity" android:theme="#android:style/Theme.Black.NoTitleBar" android:screenOrientation="portrait" android:configChanges="keyboardHidden|orientation"></activity>
<activity android:name="com.kuad.ADDisplay"/>
</application>

UserManager getUserCount() (Jelly Bean)

I am working on this class : UserManager
public int getUserCount ()
Return the number of users currently created on the device.
My code is:
UserManager um = (UserManager) getSystemService(USER_SERVICE);
int count = um.getUserCount();
Log.i("count",""+count);
It produce error like this:
Caused by: java.lang.SecurityException: You need MANAGE_USERS permission to: query users
at android.os.Parcel.readException(Parcel.java:1425)
at android.os.Parcel.readException(Parcel.java:1379)
at android.os.IUserManager$Stub$Proxy.getUsers(IUserManager.java:321)
at android.os.UserManager.getUsers(UserManager.java:198)
at android.os.UserManager.getUserCount(UserManager.java:186)
at com.example.multiusertest.MainActivity.onCreate(MainActivity.java:52)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
I already added this permission manually in Manifest file. Does anyone know why it is produce.
Manifest File:
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.MANAGE_USERS"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.multiusertest.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>
</application>
The MANAGE_USERS has a protectionlevel of signature|system, which means that the application has to be signed with the platform key. See this thread on XDA

Categories

Resources