6 Replies Latest reply on Feb 4, 2011 6:55 AM by dtcullen

    Flash Builder Burrito - Enabled Geolocation in running device?

    Teerasej Jiraphatchandej Level 1

      Hi, I am developing a simple app that will show user's geolocation in the map.

       

      I use code like this:

       

      protected function view1_creationCompleteHandler(event:FlexEvent):void
      {
           if( Geolocation.isSupported )
           {
                 g = new Geolocation();
                 g.setRequestedUpdateInterval(100);
                 if( g.muted )
                 {

                     // Don't do anything if device's sensor is muted.

                      return;
                 }
                         
                             
                 g.addEventListener(GeolocationEvent.UPDATE,geoLocation_UpdateHandler,false,0,true);
                 
           }

      }

       

      Then I modified application.xml in project like this (following Ryan Strewart's video in Adobe TV):

       

      <android>
          <manifestAdditions><![CDATA[

       

          <manifest android:installLocation="auto">

       

              <!-- See the Adobe AIR documentation for more information about setting Google Android permissions -->

       

              <uses-permission android:name="android.permission.INTERNET"/>
              <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
              <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
              <uses-configuration android:reqFiveWayNav="true"/>
              <supports-screens android:normalScreens="true"/>
              <uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch"/>

       

          </manifest>

       

      ]]></manifestAdditions>
        </android>

       

      Then I use Flash Builder Burrito to install and run application into device. The Geolocation object is muted. Even I turn on all geolocation setting. An interesting thing is, Geolocation is work in Flex de tour Mobile application.

       

      I use Samsung Galaxy S with Froyo 2.2

        • 1. Re: Flash Builder Burrito - Enabled Geolocation in running device?
          pmcalenney1

          I am having the same problem - Motorola Droid.

           

          No matter what, it reports back that Geolocation is muted, when it is on and active.  I test in google maps, works fine, but my app thinks it is muted.

           

          Anyone have any luck using Geolocation??

          • 2. Re: Flash Builder Burrito - Enabled Geolocation in running device?
            pmcalenney1 Level 1

            I am having the same problem - Motorola Droid.

             

            No matter what, it reports back that Geolocation is muted, when it is on and active.  I test in google maps, works fine, but my app thinks it is muted.

             

            Anyone have any luck using Geolocation??

            • 4. Re: Flash Builder Burrito - Enabled Geolocation in running device?
              kraikit

              I was able to test the Geolocation object successfully on a Motorola Droid using the following code:

               

              GeoTest1.mxml:

               

              <?xml version="1.0" encoding="utf-8"?>

              <s:MobileApplication xmlns:fx="http://ns.adobe.com/mxml/2009"

                                   xmlns:s="library://ns.adobe.com/flex/spark" firstView="views.GeoTest1Home">

                  <fx:Declarations>

                      <!-- Place non-visual elements (e.g., services, value objects) here -->

                  </fx:Declarations>

              </s:MobileApplication>

               

               

              GeoTest1Home.mxml:

               

              <?xml version="1.0" encoding="utf-8"?>

              <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"

                      xmlns:s="library://ns.adobe.com/flex/spark" title="Home"

                      creationComplete="view1_creationCompleteHandler(event)">

                  <fx:Script>

                      <![CDATA[

                          import flash.sensors.Geolocation;

                          import mx.events.FlexEvent;

               

                          private var g:Geolocation;

               

                          protected function view1_creationCompleteHandler(event:FlexEvent):void

                          {

                              if( Geolocation.isSupported )

                              {

                                  g = new Geolocation();

                                  g.setRequestedUpdateInterval(100);

                                  if( g.muted )

                                  {

                                      // Don't do anything if device's sensor is muted.

                                      msg.text = "geo muted";

                                      return;

                                  }

                                  msg.text = "geo active";

                                  g.addEventListener(GeolocationEvent.UPDATE,geoLocation_UpdateHandler, false,0,true);

               

                              }

                          }

               

                          protected function geoLocation_UpdateHandler(event:Event):void

                          {

                              msg.text += "\ngeolocation updated";

                          }

               

                      ]]>

                  </fx:Script>

                  <s:Label id="msg" text="foo"/>

              </s:View>

               

              GeoTest1-app.xml

               

              <?xml version="1.0" encoding="utf-8" standalone="no"?>

              <application xmlns="http://ns.adobe.com/air/application/2.6">

               

                   <id>GeoTest1</id>

               

                   <filename>GeoTest1</filename>

               

                   <name>GeoTest1</name>

                   

                   <versionNumber>1.0.0</versionNumber>

                                

               

                   <initialWindow>

                        <content>[This value will be overwritten by Flash Builder in the output app.xml]</content>

                   </initialWindow>

               

                   <android>

                        <manifestAdditions>

                        <![CDATA[

                             <manifest android:installLocation="auto">

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

                                  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

                                  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

                                  <uses-configuration android:reqFiveWayNav="true"/>

                                  <supports-screens android:normalScreens="true"/>

                                  <uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch"/>

                                  <application android:enabled="true">

                                       <activity android:excludeFromRecents="false">

                                            <intent-filter>

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

                                                 <category android:name="android.intent.category.LAUNCHER"/>

                                            </intent-filter>

                                       </activity>

                                  </application>

                             </manifest>

                        ]]>

                        </manifestAdditions>

                   </android>

              </application>

               

              Please try the above and see if it works.

               

              -- Tom

              Flex SDK engineer

              • 5. Re: Flash Builder Burrito - Enabled Geolocation in running device?
                EhlersD

                As a quick test, I embedded this into an existing test app I'm working on.  This GPS code worked perfectly on my HTC Evo 4G.

                 

                - Darren

                • 6. Re: Flash Builder Burrito - Enabled Geolocation in running device?
                  dtcullen

                  This may help someone.  I had exactly the same problem which got fixed when I pasted in the *app.xml code posted above.  The default app.xml that is generated by Burrito does have  all of the config that you need BUT it is in a comment and there is a minimal config at the bottom;

                   

                   

                  <!-- Specify Android specific tags that get passed to AndroidManifest.xml file. -->

                  <!--<android>

                  <manifestAdditions>

                  <![CDATA[

                  <manifest android:installLocation="auto">

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

                  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

                  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

                  <uses-configuration android:reqFiveWayNav="true"/>

                  <supports-screens android:normalScreens="true"/>

                  <uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch"/>

                  <application android:enabled="true">

                  <activity android:excludeFromRecents="false">

                  <intent-filter>

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

                  <category android:name="android.intent.category.LAUNCHER"/>

                  </intent-filter>

                  </activity>

                  </application>

                  </manifest>

                  ]]>

                  </manifestAdditions>

                  </android> -->

                  <!-- End of the schema for adding the android specific tags in AndroidManifest.xml file -->

                   

                   

                  ALL OF THE ABOVE IS A COMMENT AND THE ACTUAL CONFIG IS BELOW !!!!!!

                   

                  <android>

                      <manifestAdditions><![CDATA[

                  <manifest>

                  <!-- See the Adobe AIR documentation for more information about setting Google Android permissions -->

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

                  </manifest>

                  ]]></manifestAdditions>

                    </android>

                  </application>

                  I just removed the comments and the minimal config at the bottom and all was well.