2011-12-21 55 views
1

我正在編寫一個針對iPhone和Android的Rhomobile應用程序。
我需要創建自定義網址方案,以便我可以創建看起來像test://some-params的網址,該網址將啓動我的程序並將其傳遞給參數。Rhomobile:自定義URL Schemes

據我所知,這是通過BundleURLScheme參數在build.yml中完成的,然後通過System.get_start_params()來獲得這些參數。 但是,據我瞭解,這隻適用於iPhone。 有沒有什麼辦法可以使這項工作在Android上呢?

非常感謝!

回答

1

好吧,我發現自己的答案,萬一有人需要這個太:

  • 創建的擴展應用程序,這裏說明: http://docs.rhomobile.com/rhodes/extensions#generating-a-native-extension-template
  • 添加android_manifest_changes文件,如描述下上面的鏈接。
  • 在該文件中添加下列行:

    <manifest xmlns:android='http://schemas.android.com/apk/res/android' 
    android:versionName='1.0' package='com.rhomobile.webbrowserpoc' 
    android:versionCode='10000' android:installLocation='auto'> 
    <application android:name='com.rhomobile.rhodes.RhodesApplication' 
        android:label='@string/app_name' android:icon='@drawable/icon' 
        android:debuggable='true'> 
        <activity android:name='com.rhomobile.rhodes.RhodesActivity' 
         android:label='@string/app_name' android:launchMode='singleTask' 
         android:configChanges='orientation|keyboardHidden' 
         android:screenOrientation='unspecified'> 
         <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:pathPrefix='' android:scheme='' 
           android:host='' /> 
         </intent-filter> 
        </activity> 
    </application> 
    

只有<data android:pathPrefix='' android:scheme='' android:host='' />線應與正確的屬性來填充。