2012-11-19 3 views
2

PhoneGap 및 모바일 Paypal을 처음 사용합니다. 내 PhoneGap 애플 리케이션에 https://github.com/azicchetti/MECLPayPalPlugin 플러그인을 시도하고 에뮬레이터와 잘 작동합니다.Phonegap Java 기본 파일로 작성

이제 실제 전화로 테스트하기 위해 PhoneGap Build에 보내고 싶습니다. 그러나 Phonegap Build doc에 따르면 .java와 같은 원시 파일을 업로드하면 우리의 응용 프로그램이 컴파일되지 않을 가능성이 높습니다. 내 앱을 게시해야 할 때 Paypal 서버를이 플러그인에 살도록 앱 ID를 변경하는 방법은 무엇입니까?

감사합니다.

답변

2

Phonegap 빌드는 html5, css 파일 만 허용합니다. 언급했듯이 .java 파일은 지원되지 않습니다. 그러므로 당신이 당신의 안드로이드 앱을 만들고 싶다면, 이클립스에서 그것을 빌드해야하고 그러면 페이팔 플러그인과 함께 html 코드를 패키징해야합니다. 그것으로 포함 here

에서

다운로드 폰갭 라이브러리는 샘플 프로젝트이며, 그 안드로이드의 구조에뿐만 아니라 당신을 안내하고 here for the docs

가 plugins.xml의 플러그인을 정의 조회 수 쉴 수 파일을 찾으십시오.

 <config-file target="res/xml/config.xml" parent="/cordova/plugins"> 
      <plugin name="ChildBrowser" 
       value="com.phonegap.plugins.childBrowser.ChildBrowser"/> 
     </config-file> 

     <source-file src="src/android/ChildBrowser.java" 
       target-dir="src/com/phonegap/plugins/childBrowser" /> 

여기 내 참조 용 plugins.xml 파일 중 하나입니다. 를 추가 할 수

<?xml version="1.0" encoding="UTF-8"?> 
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" 
xmlns:android="http://schemas.android.com/apk/res/android" 
id="com.phonegap.plugins.childbrowser" 
version="3.0.4"> 

<name>Child Browser</name> 

<asset src="www/childbrowser.js" target="childbrowser.js" /> 
<asset src="www/childbrowser" target="childbrowser" /> 

<!-- android --> 
<platform name="android"> 
    <config-file target="AndroidManifest.xml" parent="/manifest/application"> 
     <activity android:name="com.phonegap.plugins.childBrowser.ChildBrowser" 
        android:label="@string/app_name"> 
      <intent-filter> 
      </intent-filter> 
     </activity> 
    </config-file> 

    <!-- Cordova 1.5 - 1.9 --> 
    <config-file target="res/xml/plugins.xml" parent="/plugins"> 
     <plugin name="ChildBrowser" 
      value="com.phonegap.plugins.childBrowser.ChildBrowser"/> 
    </config-file> 

    <!-- Cordova 2.0.0 --> 
    <config-file target="res/xml/config.xml" parent="/cordova/plugins"> 
     <plugin name="ChildBrowser" 
      value="com.phonegap.plugins.childBrowser.ChildBrowser"/> 
    </config-file> 

    <source-file src="src/android/ChildBrowser.java" 
      target-dir="src/com/phonegap/plugins/childBrowser" /> 
</platform> 
<!-- ios --> 
<platform name="ios"> 
    <plugins-plist key="ChildBrowser" 
       string="ChildBrowserCommand" /> 

    <resource-file src="ChildBrowser.bundle" /> 
    <resource-file src="ChildBrowserViewController.xib" /> 

    <header-file src="ChildBrowserCommand.h" /> 
    <header-file src="ChildBrowserViewController.h" /> 

    <source-file src="ChildBrowserCommand.m" /> 
    <source-file src="ChildBrowserViewController.m" /> 
</platform> 

하나 더 가지 config.xml 파일에서 플러그인을 포함

<plugin name="MECLPayPalPlugin" value="com.phonegap.plugins.paypal.MECLPayPalPlugin"/> 

당신은 당신의 프로젝트에 현재 plugins.xml 파일이없는 경우 res/xml/plugins.xml 아래에서 작성하십시오.

+0

안녕하세요, 귀하의 답변에 감사드립니다. 언급 한 모든 단계를 시도했는데 MECL 플러그인을 구현하지 않으면 제대로 작동합니다. 하지만 지금은 필요하고 라이브로 페이팔 환경을 변경해야하지만, 플러그인 지침에 따라, 나는 자바 파일에서 그것을 변경해야합니다. 그래서 PhoneGap이 자바 파일을 포함하지 않는지 어떻게 알 수 있습니까? –

+0

에서 생성 한 프로젝트에서 플러그인에서 제공하는 .java 파일을 포함하면 프로젝트의 일부인 plugins.xml 파일이 있으며 거기에 플러그인을 정의해야합니다. 대답을 보라. (예제를 추가했다.) – Dilberted

+0

config.xml에 정말로 엔트리를 만들지는 모르지만 위의 내용을 추가했다. – Dilberted