Uploaded image for project: 'Appcelerator Modules'
  1. Appcelerator Modules
  2. MOD-2421

Ti.Map Android: Remote Marker Image throws exception

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:

      Android

      Description

      From Git ticket: https://github.com/appcelerator-modules/ti.map/issues/229

      When using remote images for a marker, a java exception is thrown that seems like some sort of security issue. This doesn't seem to be present in pre-3.0 versions.

      Have tried this two different ways. The first is using an image view.

      var view = Ti.UI.createImageView(
      {
              width: 85,
              height: 85,
              itemId : itemId,
      	image : image
      });
      var ann = MapModule.createAnnotation({
      	customView: view,
      	latitude: lat,
      	longitude: lon,
      	itemId: itemId,
      	canShowCallout: false
      });
      

      And the second is a simple url added to the marker.

      var ann = MapModule.createAnnotation({
      	image: "https://someurl.com/images/someimage.jpg",
      	latitude: lat,
      	longitude: lon,
      	itemId: itemId,
      	canShowCallout: false
      });
      

      Either way, the result it the same. The following exception will be thrown.

      [WARN] :   W/System.err: android.os.NetworkOnMainThreadException
      [WARN] :   W/System.err: 	at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1317)
      [WARN] :   W/System.err: 	at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:86)
      [WARN] :   W/System.err: 	at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:74)
      [WARN] :   W/System.err: 	at java.net.InetAddress.getAllByName(InetAddress.java:752)
      [WARN] :   W/System.err: 	at com.android.okhttp.internal.Network$1.resolveInetAddresses(Network.java:29)
      [WARN] :   W/System.err: 	at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:187)
      [WARN] :   W/System.err: 	at com.android.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:156)
      [WARN] :   W/System.err: 	at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:98)
      [WARN] :   W/System.err: 	at com.android.okhttp.internal.http.HttpEngine.createNextConnection(HttpEngine.java:345)
      [WARN] :   W/System.err: 	at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:328)
      [WARN] :   W/System.err: 	at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:246)
      [WARN] :   W/System.err: 	at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:457)
      [WARN] :   W/System.err: 	at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:405)
      [WARN] :   W/System.err: 	at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:243)
      [WARN] :   W/System.err: 	at java.net.URL.openStream(URL.java:1057)
      [WARN] :   W/System.err: 	at org.appcelerator.titanium.util.TiFileHelper.handleNetworkURL(TiFileHelper.java:248)
      [WARN] :   W/System.err: 	at org.appcelerator.titanium.util.TiFileHelper.handleMessage(TiFileHelper.java:783)
      [WARN] :   W/System.err: 	at android.os.Handler.dispatchMessage(Handler.java:98)
      [WARN] :   W/System.err: 	at org.appcelerator.kroll.common.TiMessenger.sendMessage(TiMessenger.java:322)
      [WARN] :   W/System.err: 	at org.appcelerator.kroll.common.TiMessenger.sendBlockingMessage(TiMessenger.java:288)
      [WARN] :   W/System.err: 	at org.appcelerator.kroll.common.TiMessenger.sendBlockingRuntimeMessage(TiMessenger.java:190)
      [WARN] :   W/System.err: 	at org.appcelerator.titanium.util.TiFileHelper.openInputStream(TiFileHelper.java:183)
      [WARN] :   W/System.err: 	at org.appcelerator.titanium.view.TiDrawableReference.getInputStream(TiDrawableReference.java:896)
      [WARN] :   W/System.err: 	at org.appcelerator.titanium.view.TiDrawableReference.getBitmap(TiDrawableReference.java:346)
      [WARN] :   W/System.err: 	at org.appcelerator.titanium.view.TiDrawableReference.getBitmap(TiDrawableReference.java:330)
      [WARN] :   W/System.err: 	at ti.modules.titanium.ui.widget.TiUIImageView.toBlob(TiUIImageView.java:968)
      [WARN] :   W/System.err: 	at ti.modules.titanium.ui.ImageViewProxy.toBlob(ImageViewProxy.java:117)
      [WARN] :   W/System.err: 	at ti.modules.titanium.ui.ImageViewProxy.toImage(ImageViewProxy.java:46)
      [WARN] :   W/System.err: 	at ti.map.AnnotationProxy.handleCustomView(AnnotationProxy.java:259)
      [WARN] :   W/System.err: 	at ti.map.AnnotationProxy.processOptions(AnnotationProxy.java:236)
      [WARN] :   W/System.err: 	at ti.map.TiUIMapView.addAnnotation(TiUIMapView.java:438)
      [WARN] :   W/System.err: 	at ti.map.ViewProxy.handleAddAnnotation(ViewProxy.java:291)
      [WARN] :   W/System.err: 	at ti.map.ViewProxy.addAnnotation(ViewProxy.java:280)
      [WARN] :   W/System.err: 	at org.appcelerator.kroll.runtime.v8.V8Object.nativeCallProperty(Native Method)
      [WARN] :   W/System.err: 	at org.appcelerator.kroll.runtime.v8.V8Object.callProperty(V8Object.java:75)
      [WARN] :   W/System.err: 	at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1200)
      [WARN] :   W/System.err: 	at android.os.Handler.dispatchMessage(Handler.java:98)
      [WARN] :   W/System.err: 	at android.os.Looper.loop(Looper.java:154)
      [WARN] :   W/System.err: 	at android.app.ActivityThread.main(ActivityThread.java:6123)
      [WARN] :   W/System.err: 	at java.lang.reflect.Method.invoke(Native Method)
      [WARN] :   W/System.err: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
      [WARN] :   W/System.err: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
      

        Attachments

          Activity

            People

            • Assignee:
              ybanev Yordan Banev
              Reporter:
              topener Rene Pot
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Git Source Code