2015-08-16 85 views
-1

我想在Google Play商店中创建付费应用程序。谁能告诉我怎么在这里做这是我的主要活动在官方Android市场中创建付费应用程序

`public class MainActivity extends Activity { 
//private Button button; 
private WebView webView; 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 
    //Get webview 
    webView = (WebView) findViewById(R.id.webview); 
     webView.loadUrl("file:///android_asset/Index.html"); 
// Open previous opened link from history on webview when back button pressed 

@Override 
// Detect when the back button is pressed 
public void onBackPressed() { 
    if(webView.canGoBack()) { 
     webView.goBack(); 
    } else { 
     // Let the system handle the back button 
     super.onBackPressed(); 
    } 
} 
@Override 
public boolean onCreateOptionsMenu(Menu menu) { 
    // Inflate the menu; this adds items to the action bar if it is present. 
    getMenuInflater().inflate(R.menu.main, menu); 
    return true; 
} 

@Override 
public boolean onOptionsItemSelected(MenuItem item) { 

    if(item.getItemId() == R.id.disclaimer) { 

     Intent k = new Intent(this, Webscreen.class); 
     k.putExtra(cf.droiddev.oursolarsystem.Webscreen.URL, 
      "file:///android_asset/Disclaimer.html"); 
     startActivity(k); 
     return true;  
    } 

    if(item.getItemId() == R.id.about) { 

     Intent j = new Intent(this, About.class); 
     startActivity(j); 
     return true; 
    } 

if(item.getItemId() == R.id.exit) { 

     AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
       MainActivity.this); 
       // set title 
       alertDialogBuilder.setIcon(android.R.drawable.ic_dialog_alert).setTitle("Exit App"); 
       // set dialog message 
       alertDialogBuilder 
       .setMessage("Do you want to exit") 
       .setCancelable(false) 
       .setPositiveButton("Yes",new DialogInterface.OnClickListener() { 
       @Override 
       public void onClick(DialogInterface dialog,int id) { 
       // if this button is clicked, close 
       // current activity 
       MainActivity.this.finish(); 
       } 
       }) 
       .setNegativeButton("No",new DialogInterface.OnClickListener() { 
       @Override 
       public void onClick(DialogInterface dialog,int id) { 
       // if this button is clicked, just close 
       // the dialog box and do nothing 
       dialog.cancel(); 
       } 
       }); 
       // create alert dialog 
       AlertDialog alertDialog = alertDialogBuilder.create(); 
       // show it 
       alertDialog.show(); 
       return true; 
    } 

    return super.onOptionsItemSelected(item); 
} 

}` 

,这里是我的主要activity.xml

`

<WebView 
    android:id="@+id/webview" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" /> 
</RelativeLayout>` 

任何帮助,将不胜感激。我尝试了谷歌的文档,但它给我的项目错误

+0

我已upvoted它取消愚蠢downvote(这是没有评论)。 –

+1

您需要发布您的应用(http://teamtreehouse.com/library/publish-an-android-app?cid=1000),然后在[dev console](https://play.google.com)中指定/ apps/publish /)您的列表价格。 –

+3

@RohitGupta没有downvote,但downvotes不需要评论,并不愚蠢。他们是意见。只是为了取消某人的意见而进行的举措是不好的做法。这个问题很糟糕,因为代码与实际问题没有任何关系,并且可以通过转到Google的文档来回答问题。 –

回答

1

与免费应用程序相比,付费应用程序没有区别。当您在Google Play Console中提交您的应用时,您可以指定其价格 - 无论是否为0美元或更多。您不能免费提交并在付费后付款!

如果您希望在应用程序中付费(例如在大多数游戏中购买更多的生命),则会有所不同。它需要Google Play控制台的实施变更和配置。 Here是此类交易的官方文档。

相关问题