상세 컨텐츠

본문 제목

[air for android , IOS ]app에서 air로 만든 app호출 하면서 파라미터 보내기

ADOBE/ ActionScript

by AlrepondTech 2016. 6. 22. 17:21

본문

반응형

 

 

 

 

 

=================================

=================================

=================================

 

 

 

 

 

 

출처: http://blog.naver.com/babdeuk/90163825962

The Space For App Developers


Defining custom URL schemes for your AIR mobile applications

 

twitter.com/widgets/tweet_button.1366154648.html#_=1366185332070&count=vertical&id=twitter-widget-0&lang=en&original_referer=http%3A%2F%2Fwww.riaspace.com%2F2011%2F08%2Fdefining-custom-url-schemes-for-your-air-mobile-applications%2F&size=m&text=Defining%20custom%20URL%20schemes%20for%20your%20AIR%20mobile%20applications%20at%20The%20Space%20For%20App%20Developers&url=http%3A%2F%2Fwww.riaspace.com%2F2011%2F08%2Fdefining-custom-url-schemes-for-your-air-mobile-applications%2F" class="twitter-share-button twitter-count-vertical" title="Twitter Tweet Button" data-twttr-rendered="true" style="padding: 0px; margin: 0px; width: 59px; height: 62px;"></iframe>If you’ve ever wondered if you can register your own URL schemes for your AIR mobile applications running on iOS or Android platforms the answer is yes! Actually it is very simple and you can do it by adding few extra lines in the *-app.xml document. Once you do your application can be invoked directly from other applications or browser with a simple <a href="my-scheme:">open app</a> link click.
(Custom URL schemes are especially useful if you are doing OAuth authentication in your app and you want to redirect the user back to your application after the authorization in the browser. You can find out more about OAuth in AS3/Flex applications in my ADC tutorials.)
To register a custom URL scheme like my-scheme: you simply add the following code in your *-app.xml.

 

Android settings:

<android>     <manifestAdditions>     <![CDATA[         <manifest android:installLocation="auto">             <application>                  <activity>                      <intent-filter>                          <action android:name="android.intent.action.VIEW"/>                          <category android:name="android.intent.category.BROWSABLE"/>                          <category android:name="android.intent.category.DEFAULT"/>                          <data android:scheme="my-scheme"/>                      </intent-filter>                  </activity>              </application>                <uses-permission android:name="android.permission.INTERNET"/>           </manifest>     ]]>     </manifestAdditions> </android>

iOS settings:

<iPhone>  <InfoAdditions>  <![CDATA[   <key>UIDeviceFamily</key>   <array>    <string>1</string>    <string>2</string>   </array>     <key>CFBundleURLTypes</key>   <array>    <dict>     <key>CFBundleURLSchemes</key>     <array>      <string>my-scheme</string>     </array>     <key>CFBundleURLName</key>     <string>com.myapp</string>    </dict>   </array>    ]]>  </InfoAdditions>         <requestedDisplayResolution>high</requestedDisplayResolution> </iPhone>

Also you can pass additional arguments to your app from the invoking source. Arguments can be passed in the URL scheme after the colon; for example: my-scheme:myparam. Then in your application you can listen forInvokeEvent.INVOKE event on the NativeApplication.nativeApplication instance. The received event object contains an arguments property that returns an Array with the invoking scheme and parameters in the first item, so it would be my-scheme:myparam value. Next you can parse the value of your argument, and take some action in the application based on its value.

In a Flex Mobile app you can register an InvokeEvent.INVOKE event listener in the preinitialize phase as in following snippet:

  <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"        xmlns:s="library://ns.adobe.com/flex/spark"       preinitialize="application_preinitializeHandler(event)">    <fx:Script>   <![CDATA[    import mx.events.FlexEvent;      protected function application_preinitializeHandler(event:FlexEvent):void    {     NativeApplication.nativeApplication.addEventListener(      InvokeEvent.INVOKE, onInvoke);    }      private function onInvoke(event:InvokeEvent):void    {     // You can parse argument value from event.arguments property     lblArguments.text = "Arguments: " + event.arguments;    }     ]]>  </fx:Script>    <fx:Declarations>   <!-- Place non-visual elements (e.g., services, value objects) here -->  </fx:Declarations>    <s:Label id="lblArguments" horizontalCenter="0" verticalCenter="0" />   </s:Application>

One caveat is that invoking other apps with the custom URL schemes from AIR apps is not possible. The AIR security model is more restrictive and it limits schemes to: http:, https:, sms:, tel:, mailto:, file:, app:, app-storage:, vipaccess: and connectpro:. You can find more about it here and here
.

 

 

출처 ) http://www.riaspace.com/2011/08/defining-custom-url-schemes-for-your-air-mobile-applications/#comments

 

 

 

 

=================================

=================================

=================================

 

 

 

출처: https://forums.adobe.com/message/5146487#5146487

Air Android - Adapt the intent filter for receiving content from other apps

이 질문은 답변 안 됨 상태입니다.

blogtomLevel 1

Hi,

 

I would like to use the Android intent filter for receiving content from other apps in an Air for Android app. What do I need to enter for .ui.MyActivity?

 

This is from the Android documentation:

 

When another application tries to share any of these things by constructing an intent and passing it to startActivity(), your application will be listed as an option in the intent chooser. If the user selects your application, the corresponding activity (.ui.MyActivity in the example above) will be started. It is then up to you to handle the content appropriately within your code and UI.

 
  1. <activity android:name=".ui.MyActivity" >  
  2.  <intent-filter>  
  3.         <action android:name="android.intent.action.SEND" />  
  4.         <category android:name="android.intent.category.DEFAULT" />  
  5.         <data android:mimeType="text/plain" />  
  6.     </intent-filter>  
  7. </activity>  

I'm using Adobe Air 3.6 and Flash CS 6.

 
 

     

     

    =================================

    =================================

    =================================

     

     

    반응형


    관련글 더보기

    댓글 영역