i'm making an app for android 2.2+ using facebook sdk too. my app is working fine and so before putting it on the market i decided to put some ads with admob. to use admob with previous version you have to compile with adnroid 32+ so that's what i did (i used api 15). in android 2.2-3.2 my app works and admob too, but in ICS (i'm testing it on a nexus with android 4.0.4) admob doesn't show any ads, some facebook requests give back a null result and some downloads of picture give error (i say "some" because other requests and other downloads of picture work..).
I'll post here the relevant parts of my manifest and the other two errors. if remove ads and compile my app to 2.2 it begins to work fine again...
in my project.properties:
# Project target.
target=android-15
my manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
package="com.***.***"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8"
android:targetSdkVersion="15"
/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:icon="#drawable/icon_transparent_zk"
android:label="***" >
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
here's the request for facebook (i need it to get the user id):
String result_me = mFacebook.request("me");
and now the image, i can assure you that the url contained in the json is correct:
URL img_value = new URL(json.getString("pic"));
Bitmap icon = BitmapFactory.decodeStream(img_value.openConnection().getInputStream());
if anyone could help me i'd really appreciate it! thank you
Ice cream sandwich (or even Honeycomb if I recall correctly) doesnt allow you to perform network operations on the main thread.
Perform your admob requests in a Thread object.
(new Thread() {
public void run() {
//Admob stuff
}
}).start();
This is to ensure you dont ANR your app on long network operations.
Related
When I start to install myapp.apk, I get the below screen.
My app requires Location, External Storage permission. Above permissions are supposed to be requested from user as required i.e. just before the code which required these permissions.
Now , when app is installed I get a screen which say App doesn't require any special access as in the screen below. Why?
This is my permission code in Manifest file.
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.previders.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
<uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
With Android 6.0, was introduced the new Android permissions runtime control. Shortly: on older devices all permissions were provided on install of app, from Android M needed permission is used only on runtime, when it is really needed, like Camera activity.
Are you overwriting app? This scenario happens when you already have app installed and installing same app or same app with new version.
If you don't have any new permission added in new app then it will show like that.
As Jadav Lalit already said:
if you install an app it will ask for the permissions it needs. This is also the case for installing, uninstalling and re-installing an app.
if you reinstall or install a newer version of the app without new permissions, it will not ask for any permissions.
On a side note, if you only need Location and External Storage permission you should only have ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION, READ_EXTERNAL_STORAGE and maybe WRITE_EXTERNAL_STORAGE.
You could also add ACCESS_LOCATION_EXTRA_COMMANDS since you use location.
Anyhow a complete list is here: https://developer.android.com/reference/android/Manifest.permission.html
They are all there and up to date, but the description can be a little short sometimes.
A more descriptive list is here: http://androidpermissions.com/ but seems a little out of date updated.
I cannot get Google Maps to work on my app.
I see a blank screen; no grids show, only the google logo and the +/- zoom buttons.
What I have done:
I have the "Google Maps Android API v2" API enabled
I have added my project along with the demo project to the API credential list on Google console
I've also added the required permissions for Internet, location, com.google.android.providers.gsf.permission.READ_GSERVICES.
Even added the "MAPS_RECEIVE" permission as some posts suggested
Also added the 'meta-data' google_play_services_version
Since the demos are working, I literally copied MultiMapDemoActivity and its files into my project and tried opening map, to no avail.
The problem may be linked to this issue. However, it seems like they can't get map to work at all.
Here is the interesting bit that I noticed, I usually get this:
10-02 12:29:20.376: D/REQUEST(5826): Connection opened to:https://clients4.google.com/glm/mmap/api
10-02 12:29:20.376: D/REQUEST(5826): Open Connection
Followed by this:
10-02 12:21:45.361: D/REQUEST(5826): DRD(80): 62|132
10-02 12:21:45.361: D/REQUEST(5826): Close
10-02 12:21:45.361: D/REQUEST(5826): Error processing: com.google.maps.api.android.lib6.b.d#42caa7b8 not retrying
10-02 12:21:45.361: D/REQUEST(5826): Retrying: com.google.maps.api.android.lib6.gmm6.c.a#4296a530
Also, not sure if this is relevant, but as soon as I click to open the map, or click on the map after it has opened and is showing a blank view, I see this:
10-02 13:03:32.978: E/DatabaseUtils(15468): Writing exception to parcel
10-02 13:03:32.978:/DatabaseUtils(15468): java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this
requires android.permission.INTERACT_ACROSS_USERS_FULL
EDIT #1
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
EDIT #2
Also, the declared package name was com.A.B.C (the manifest); whereas the activities of my project had the structure of com.A.B..
I have since updated my project structure to match that of the manifest, but I still see the same errors as before, nothing changes. I'm really at sea here, since I cannot understand what could be going wrong here.
Some help to resolve this will be appreciated, thanks!
It turns out that I had read n-1 questions regarding this issue here. Finally, after continuous searching everywhere, I stumbled upon the answer here by #Jack.
Basically the line:"HttpsURLConnection.setDefaultSSLSocketFactory(...)" was the culprit in my code. I commented it out and everything worked fine.
NOTE: I have not tried to keep the line of code and modify it to make maps work yet. If I need/do it, I'll post a comment.
You need to add your SHA1 fingerprint to the public API access.
Go to eclipse > preferences. Android > build and copy your default eclipse SHA1 fingerprint.
Now go to https://console.developers.google.com select your app, 'APIs and auth' > 'credentials' > and click on 'Edit allowed android applications' put your SHA1 figerfirnt like that:
XX:XX:XX:XX:XX...XX;com.your.pakage.app
What about your google key? This line in the Manifest file:
<meta-data android:name="com.google.android.maps.v2.API_KEY"
....
I am also struggling with such behavior constantly. The first thing you want to verify in such situations is that your key from debug.keystore file is indeed the one that you registered with Google. This key will be used when you are debugging your application locally.
Note, however, you will need another keystore file when you release your application. At the time of signing, you should create another keystore, and register it too with Google.
I had this problem too and it took me so much hours to resolve it, at last I've done these steps and it worked finally!
Do the same steps as it followed here https://developers.google.com/maps/documentation/android/start
Use the debug certificate fingerprint if you're testing your project instead of the release certificate which you use when you install your app in the play store.
Don't forget to add the value of the Google API and replace the "API_VALUE" with it.
Change your project build target into Google APIs: Project>properties>android>target.
Hope this helps..
These are the permissions you need according to Google documentation:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- The following two permissions are not required to use
Google Maps Android API v2, but are recommended. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
I recommend you to include this too:
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
Add those in your manifest file
<permission
android:name="xxx.xxxx.xxxx.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="xxx.xxxx.xxxx.permission.MAPS_RECEIVE" />
<uses-permission android:name="xxx.xxxx.xxxx.permission.READ_GSERVICES" />
replace xxx.xxxx.xxxx with your package name
I have made an app in flash for android and I have followed everything as said here: http://www.adobe.com/devnet/air/articles/admob-ane-android.html to show ads in my app, but the ads ain't showing up, if I place this code:
if(AdMob.isSupported)
{
AdMob.init("my publisher id");
}
else
{
trace("AdMob won't work on this platform!");
return;
}
AdMob.addEventListener(AdMobErrorEvent.FAILED_TO_RECEIVE_AD,onFailedReceiveAd);
function onFailedReceiveAd(e:AdMobErrorEvent):void
{
trace("Ad failed to load.");
}
AdMob.showAd(AdMobAdType.BANNER,AdMobAlignment.LEFT,AdMobAlignment.BOTTOM);
above all the other code nothing works anymore and if I place this code below all the rest code the app works but the ads never show up, does someone know how I can show my ads??
AdMob.isSupported will always return false if you're testing on the simulator. So you've to test on device to be able to test AdMob in general.
I manage to notice that milkmangames Admob ANE has some issues. Just out of the sudden no ads and i mean not a single ad is displayed under intervals of time. milkman games ads aren't displayed without notice. At first i thought it was google fault but unity ads are working perfectly. People are loosing serious amounts of money because of this.
Perhaps google is blocking ads for milkman games ANE?
I had a similar problem, and wrote to Milkman. They politely suggested I read the manual - GettingStarted.pdf, and sure enough, in there is a note about setting up your -app.xml properly.
You need to include certain manifestAdditions in the android section of -app.xml:
<android>
<manifestAdditions><![CDATA[
<manifest android:installLocation="auto">
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application>
<!-- this meta-data tag is required for AdMob -->
<meta-data android:name="com.google.android.gms.version" android:value="4452000"/>
<!-- this activity is required for AdMob -->
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="#android:style/Theme.Translucent.NoTitleBar"/>
</application>
</manifest>
]]></manifestAdditions>
</android>
I have implemented Google Map V2 in my application, Everything works just fine.
Checked on 2-3 mobiles and tabs it runs perfectly,
But it runs for 10 to 15 times a day on single device.,after that it does not load map on same device and gives following error.
05-06 07:17:41.866: E/Google Maps Android API(17217): Failed to load map. Could not contact Google servers.
In short, sometimes it displays map and sometimes it does not.
I m using map key generated from android debug key.
Please suggest some solutions for this.
My Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ocatalog.mapdemo"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<permission
android:name="com.ocatalog.mapdemo.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.ocatalog.mapdemo.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyA9E-oCIM2d5rlhxnsJf66Bly57JXpkiKI" />
<activity
android:name="com.ocatalog.mapdemo.MapDemoActivity"
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>
</manifest>
I am experiencing the same problem, the maps are running OK on multiple devices, but randomly show a blank screen, sometimes for days.
When I debug the code I can see that all actions like adding markers, overlays, etc. are executed properly.
Also, no idea if this is related, but the Geocoder seems to be working correctly in the meanwhile, so it is definitely not related to an Google Services connectivity issue(or is it?).
Besides, the map also works fine offline and the cache data is stored properly (well, most of the time that is).
Clearing my app's cache and data also doesn't help. Nor does doing so for the Google Services app.
However, reinstalling the application seems to fix it for most of the time, but does not prevent it from reoccurring.
Add the following permission in your manifest file
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
There are Google Maps API v2 and Google Maps Android API v2.
You should use Google Maps Android API v2.
I am working in Iran, I had used Google map v1 for long time, now that I have to use Google map v2, I just can see a grey blank page with zoom icon only, I have done every thing based on Google instructions, I think I have done everything.
*I WANT TO KNOW IF THIS PROBLEM IS RELATED TO GOOGLE POLICY THAT MEANS SOME COUNTRIES ARE NOT ALLOWED TO USE GOOGLE PLAY SERVICES AND MAP .... *
THIS IS A BIG PROBLEM FOR ME NOW
THX
this is the manifest file of my code :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pea.map001v2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="17" />
<permission
android:name="your.package.name.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="your.package.name.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.
permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.pea.map001v2.MainMapActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyCk0HwJYHIjM9W_eqqTB1C5wyB-2B0B5U4" />
</application>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
</manifest>
You Must Run your app in amulator having Following Configuration....
Google API(x86 System image)
Select checkBox indicating "Use Host GPU..."
If anything this could be related to Iran's policy and not Google's.
The problem you describe usually happens when you have a problem with the API key you have generated or the way you registered it in the Console.
You can go over this blog post I wrote on getting the Google API V2 key:
Google Map API V2 key
Maybe, you missed one of this:
Didn't include the Google API Key v2 in the manifest.xml
Didn't add the package name in Android maps Key(Console) , example:
ABczzisierkaiSAisi-Ka2;my.project.package
Didn't add Internet Permissions, on manifest.xml.
Your Android device doesn't have an internet connection
NOTE: If you are using a Virtual Device, it won't work, beacuase it needs Google Play Services
I used to face the same problem as yours. The first thing you need to check is Google Maps Android API Key. Then check the settings in AndroidManifest.xml. There are detail instructions in following link: Android Maps Android v2
yes, it's because of country ._.
i have this issue too on javaScript apis, but it works out with proxy..