Can I run an HTTP server on a mobile platform?

2019-02-04 22:54发布

I am building a webapp that cannot be put into the app store (security reasons). The webapp needs access to more data than can be held in localStorage or other offline-storage means (let's say up to 1GB of data).

My idea of a solution is to code up an HTTP server for Android and iOS, and then get/post data with AJAX so I can have access to the device's internal storage.

My question is,

Can this be done on iOS and Android?

By 'Can', I mean both technically (is there API access to the required components, and can it be always running in the background) and legally (is it consistent with the terms of service of both the App Store and Android Marketplace).

I don't know much about either platform and the capabilities, but I could figure it out if I was confident that it is possible.

The reason for this is so that large amounts of data can be made available all the time to a webapp, regardless of the presence of wifi or a cell-tower.

2条回答
三岁会撩人
2楼-- · 2019-02-04 23:25

Yes

For a full app that uses an http server, check out Websharing on Android.

查看更多
欢心
3楼-- · 2019-02-04 23:33

Please use this Android Application which is free and works smoothly.

https://play.google.com/store/apps/details?id=jp.ubi.common.http.server&hl=en

Advantages:

  • You can point to any directory as "Document Root" (Ex:
    /sdcard/yourapp/ instead of /var/www)
  • Free of cost

Disadvantages:

  • It can run the server only on PORT:12345 Not 100% secure
查看更多
登录 后发表回答