Select to view content in your preferred language

Failed to Add Bing logo error

2728
7
Jump to solution
10-18-2012 12:56 AM
ThomasBinu
Deactivated User
I am trying to use Bing maps for my android application, but the app crases with this error 'Failed to add the bing maps Logo' and a Networkonmainthread Exception.
I am testing it on a galaxy s2 running android ICS.
Here is my code:

MapView map = new MapView(this);
BingMapsLayer bingLayer = new BingMapsLayer(
     "appkey",
     MapStyle.AERIAL);
bingLayer.getBingLogo(5,5);
map.addLayer(bingLayer);
setContentView(map);

Please help. Thanks in advance.
0 Kudos
1 Solution

Accepted Solutions
DanO_Neill
Deactivated User
What version of the SDK are you using?  This issue was resolved in our latest release of the SDK, v2.0.

View solution in original post

0 Kudos
7 Replies
EnriqueIbarra
Deactivated User
I've used Bing map, and to show it just is necessary declare our bing map layer and instance it:
BingMapsLayer bingLayer;
bingLayer = new BingMapsLayer("Here_Your_Bing_Key", MapStyle.Aerial);
myMap.addLayer(bingLayer);


don't know how or for what works the method "getLogo()", I've tried to use it but never works as I thought.
0 Kudos
ThomasBinu
Deactivated User
I've used Bing map, and to show it just is necessary declare our bing map layer and instance it:
BingMapsLayer bingLayer;
bingLayer = new BingMapsLayer("Here_Your_Bing_Key", MapStyle.Aerial);
myMap.addLayer(bingLayer);


don't know how or for what works the method "getLogo()", I've tried to use it but never works as I thought.


Thanks for the reply. It seems the app crashes, because android 4.0+ devices require you to run network operations outside the UI thread.
I added these lines before initializing the Bing maps to suppress the networkonmainthread exception and it works for now(but I never had this problem when using ESRI maps ).

StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);

I tried moving the bing maps initialization outside the UI thread using Asynctask class, but the app still crashes. with the networkOnMainThread exception. Can anyone shed some light on this issue?
0 Kudos
DanO_Neill
Deactivated User
What version of the SDK are you using?  This issue was resolved in our latest release of the SDK, v2.0.
0 Kudos
ThomasBinu
Deactivated User
What version of the SDK are you using?  This issue was resolved in our latest release of the SDK, v2.0.


I am using version 2.0 of ArcGIS SDK.
0 Kudos
DanO_Neill
Deactivated User
Was the project built from v2.0 project templates?  With v2.0 installed, right click your ArcGIS for Android Project and select ArcGIS Tools > Fix Project Properties to ensure that you are using both the latest jars and native libs.  Please share some screenshots of your Java Build Path and the logcat if you continue to have issues using v2.0 of the SDK.
0 Kudos
DanO_Neill
Deactivated User
I did some more testing/investigating and realized that we did not include the fix in v2.  The issue is that the BingMapsLayer is retrieving the Bing Logo on the main thread.  Android apps targeting SDK 12 (Honeycomb) or higher does not allow network usage on the main UI thread and retrieving the Bing Maps Logo makes a network call.  The fix will be in the next release of the SDK.  In the mean time, if you are targeting platform API version 12 or higher you can explicitly turn off StictMode.  This is not an issue if your minSDK  is set to something lower than 12, e.g. 8 and your platform level is the same.
0 Kudos
ThomasBinu
Deactivated User
I did some more testing/investigating and realized that we did not include the fix in v2.  The issue is that the BingMapsLayer is retrieving the Bing Logo on the main thread.  Android apps targeting SDK 12 (Honeycomb) or higher does not allow network usage on the main UI thread and retrieving the Bing Maps Logo makes a network call.  The fix will be in the next release of the SDK.  In the mean time, if you are targeting platform API version 12 or higher you can explicitly turn off StictMode.  This is not an issue if your minSDK  is set to something lower than 12, e.g. 8 and your platform level is the same.



Thank you very much for the reply. Can you give us an ETA for the the next version of the SDK. Also unlike the iOS version ,android doesn't have support for openstreetmaps. Will this be included in the next release?
0 Kudos