问题
Goal
Let's say I have a fully responsive web app that's hosted at, say, http://example.com.
Now, I want to build a mobile app for Android and iOS that just points to my web app. i.e., When the user opens the app, it navigates them to example.com and that's it.
Question
- What is the procedure for doing this?
- Are there any tools out there that make this simple?
Clarification
This StackOverflow answer says:
This is how you do it for Android:
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
context.startActivity(browserIntent);
This is how you do it for iOS:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.google.com"]];
But this question is asking for a simple procedure. Perhaps with a simple CLI for Cordova, Android SDK, Xcode or something similar?
For example, this page says you can access Android SDK tools from a command line at: /Users/<user>/Library/Android/sdk/
.
回答1:
Summary from comments:
$ cordova create myProject
- Open
config.xml
- Change
index.html
tohttp://www.example.com
Here is the Cordova documentation.
Also, note that to use the CLI you must first install the SDKs for your target platforms. Click here for the platform guides documentation.
Breaking news: This doesn't work.
回答2:
Here is a good video that explains how to do this by going into Android SDK and doing everything manually.
https://youtu.be/LzlNP9nS6fo?t=11m1s
Here is a link to the code.
http://bitly.com/1wZTLxK
来源:https://stackoverflow.com/questions/33624419/android-and-ios-mobile-app-that-points-to-web-app-url