Skip to content
This repository was archived by the owner on Sep 29, 2023. It is now read-only.

Commit 70e4619

Browse files
Merge pull request #42 from appwrite/0.9.x
0.9.x
2 parents dd4a432 + efaa824 commit 70e4619

File tree

7 files changed

+292
-58
lines changed

7 files changed

+292
-58
lines changed
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<?php
2+
$platforms = $this->getParam('platforms');
3+
$versions = [];
4+
5+
foreach($platforms['client']['languages'] as $lang) {
6+
$key = $lang['key'] ?? '';
7+
$version = $lang['version'] ?? '';
8+
9+
if(!empty($key)) {
10+
$versions[$key] = $version;
11+
}
12+
}
13+
14+
$androidVersion = (isset($versions['android'])) ? $versions['android'] : '';
15+
?>
16+
<p>Appwrite is a development platform providing you an easy yet powerful API and management console to get your next project up and running quickly.</p>
17+
18+
<p>This tutorial will help you start using Appwrite products and build your next project. Before starting, make sure you have followed the Appwrite <a href="/docs/installation">installation guide</a>, and you have an Appwrite server instance up and running on your host machine or server.</p>
19+
20+
<h2>Create Your First Appwrite Project</h2>
21+
22+
<p>Go to your new Appwrite console, and once inside, click the <i class="icon-plus"></i> icon in the top navigation header or on the <b>'Create Project'</b> button on your console homepage. Choose a name for your project and click create to get started.</p>
23+
24+
<h2>Add your Android Platform</h2>
25+
26+
<p>To init your SDK and start interacting with Appwrite services, you need to add a new Android platform to your project. To add a new platform, go to your Appwrite console, choose the project you created in the step before, and click the 'Add Platform' button.</p>
27+
28+
<p>From the options, choose to add a new <b>Android</b> platform and add add your app <u>name</u> and <u>package name</u>, Your package name is generally the applicationId in your app-level build.gradle file. By registering your new app platform, you are allowing your app to communicate with the Appwrite API.</p>
29+
30+
<h2>Get Appwrite Android SDK</h2>
31+
32+
<p>First, add this to your root level build.gradle file: </p>
33+
<div class="ide" data-lang="groovy" data-lang-label="Groovy">
34+
<pre class="line-numbers"><code class="prism language-groovy" data-prism><?php echo $this->escape('repositories {
35+
mavenCentral()
36+
}');?></code></pre>
37+
</div>
38+
39+
<p>And add this to your project's build.gradle file:</p>
40+
41+
<div class="ide" data-lang="groovy" data-lang-label="Groovy">
42+
<pre class="line-numbers"><code class="prism language-groovy" data-prism>'implementation("io.appwrite:sdk-for-android:<?php echo $this->escape($androidVersion); ?>")'</code></pre>
43+
</div>
44+
45+
<h3>OAuth Callback</h3>
46+
47+
<p>In order to capture the Appwrite OAuth callback url, the following activity needs to be added to your <a href="https://github.com/appwrite/playground-for-android/blob/app/src/main/AndroidManifest.xml" target="_blank" rel="noopener">AndroidManifest.xml</a>. Be sure to replace the <b>[PROJECT_ID]</b> string with your actual Appwrite project ID. You can find your Appwrite project ID in you project settings screen in your Appwrite console.</p>
48+
49+
<div class="ide" data-lang="html" data-lang-label="XML">
50+
<pre class="line-numbers"><code class="prism language-xml" data-prism><?php echo $this->escape('<activity android:name="io.appwrite.views.CallbackActivity" >
51+
<intent-filter android:label="android_web_auth">
52+
<action android:name="android.intent.action.VIEW" />
53+
<category android:name="android.intent.category.DEFAULT" />
54+
<category android:name="android.intent.category.BROWSABLE" />
55+
<data android:scheme="appwrite-callback-[PROJECT_ID]" />
56+
</intent-filter>
57+
</activity>'); ?></code></pre>
58+
</div>
59+
60+
<h2>Init your SDK</h2>
61+
62+
<p>Initialize your SDK code with your project ID, which can be found in your project settings page.</p>
63+
64+
<div class="ide" data-lang="android" data-lang-label="Android SDK">
65+
<pre class="line-numbers"><code class="prism language-kotlin" data-prism>import io.appwrite.Client
66+
import io.appwrite.services.Account
67+
68+
val client = Client(context)
69+
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
70+
.setProject("5df5acd0d48c2") // Your project ID
71+
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
72+
.setSelfSigned(true) // For self signed certificates only use for development</code></pre>
73+
</div>
74+
75+
<p>Before starting to send any API calls to your new Appwrite instance, make sure your Android emulators has network access to the Appwrite server hostname or IP address.</p>
76+
77+
<p>When trying to connect to Appwrite from an emulator or a mobile device, localhost is the hostname for the device or emulator and not your local Appwrite instance. You should replace localhost with your private IP as the Appwrite endpoint's hostname. You can also use a service like <a href="https://ngrok.com/" target="_blank" rel="noopener">ngrok</a> to proxy the Appwrite API.</p>
78+
79+
<h2>Make Your First Request</h2>
80+
81+
<p>Once your SDK object is set, access any of the Appwrite services and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section.</p>
82+
83+
<div class="ide" data-lang="android" data-lang-label="Android SDK">
84+
<pre class="line-numbers"><code class="prism language-kotlin" data-prism>// Register User
85+
val account = Account(client)
86+
val response = account.create("[email protected]", "password")
87+
val json = response.body?.string()</code></pre>
88+
</div>
89+
90+
<h2>Full Example</h2>
91+
<div class="ide" data-lang="android" data-lang-label="Android SDK">
92+
<pre class="line-numbers"><code class="prism language-kotlin" data-prism>import io.appwrite.Client
93+
import io.appwrite.services.Account
94+
95+
val client = Client(context)
96+
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
97+
.setProject("5df5acd0d48c2") // Your project ID
98+
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
99+
.setSelfSigned(true) // For self signed certificates only use for development
100+
101+
val account = Account(client)
102+
val response = account.create("[email protected]", "password")
103+
val json = response.body?.string()</code></pre>
104+
</div>
105+
106+
<h2>Next Steps</h2>
107+
108+
<p>Appwrite has many services and tools to help improve your app and speed up your development. The best way to learn how you can take advantage of them is to explore the different API references docs.</p>

app/views/docs/getting-started-for-flutter.phtml

Lines changed: 45 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,44 +25,13 @@ $version = (isset($versions['flutter'])) ? $versions['flutter'] : '';
2525

2626
<p>To init your SDK and start interacting with Appwrite services, you need to add a new Flutter platform to your project. To add a new platform, go to your Appwrite console, choose the project you created in the step before, and click the 'Add Platform' button.</p>
2727

28-
<p>From the options, choose to add a new <b>Flutter</b> platform and add your app credentials. Appwrite Flutter SDK currently supports building apps for both iOS and Android.</p>
28+
<p>From the options, choose to add a new <b>Flutter</b> platform and add your app credentials. Appwrite Flutter SDK currently supports building apps for Android, iOS, Linux, Mac OS, Web and Windows.</p>
2929

3030
<p>If you are building your Flutter application for multiple devices, you have to follow this process for each different device.</p>
3131

32-
<h3>iOS</h3>
33-
<p>For <b>iOS</b> add your app <u>name</u> and <u>Bundle ID</u>, You can find your Bundle Identifier in the General tab for your app's primary target in Xcode.</p>
34-
3532
<h3>Android</h3>
36-
<p>For <b>Android</b> add your app <u>name</u> and <u>package name</u>, Your package name is generally the applicationId in your app-level build.gradle file. By registering your new app platform, you are allowing your app to communicate with the Appwrite API.</p>
3733

38-
<h2><a href="#getSDK" id="getSDK">Get Appwrite Flutter SDK</a></h2>
39-
40-
<p>Add <a href="https://pub.dev/packages/appwrite" target="_blank" rel="noopener">Appwrite SDK</a> to your package's pubspec.yaml file <a href="https://github.com/appwrite/playground-for-flutter/blob/master/pubspec.yaml" target="_blank" rel="noopener">(view example)</a>:</p>
41-
42-
<div class="ide margin-bottom" data-lang="yaml" data-lang-label="yaml">
43-
<pre class="line-numbers"><code class="prism language-yaml" data-prism>dependencies:
44-
appwrite: ^<?php echo $this->escape($version); ?>
45-
</code></pre>
46-
</div>
47-
48-
<p>You can also install the SDK using the <a href="https://pub.dev/" target="_blank" rel="noopener">Dart package manager</a> from your terminal:</p>
49-
50-
<div class="ide margin-bottom" data-lang="bash" data-lang-label="Bash">
51-
<pre class="line-numbers"><code class="prism language-bash" data-prism>pub get appwrite</code></pre>
52-
</div>
53-
54-
<h3>iOS</h3>
55-
56-
<p>The Appwrite SDK uses ASWebAuthenticationSession on iOS 12+ and SFAuthenticationSession on iOS 11 to allow OAuth authentication. You have to change your iOS Deployment Target in Xcode to be iOS >= 11 to be able to build your app on an emulator or a real device.</p>
57-
58-
<ol class="margin-top margin-bottom-large">
59-
<li class="margin-bottom-small">In Xcode, open Runner.xcworkspace in your app's ios folder.
60-
<li class="margin-bottom-small">To view your app's settings, select the Runner project in the Xcode project navigator. Then, in the main view sidebar, select the Runner target.</li>
61-
<li class="margin-bottom-small">Select the General tab.</li>
62-
<li class="margin-bottom-small">In Deployment Info, 'Target' select iOS 11.0</li>
63-
</ol>
64-
65-
<h3>Android</h3>
34+
<p>For <b>Android</b> first add your app <u>name</u> and <u>package name</u>, Your package name is generally the <b>applicationId</b> in your app-level <a href="https://github.com/appwrite/playground-for-flutter/blob/0fdbdff98384fff940ed0b1e08cf14cfe3a2be3e/android/app/build.gradle#L41" target="_blank" rel="noopener">build.gradle</a> file. By registering your new app platform, you are allowing your app to communicate with the Appwrite API.</p>
6635

6736
<p>In order to capture the Appwrite OAuth callback url, the following activity needs to be added to your <a href="https://github.com/appwrite/playground-for-flutter/blob/master/android/app/src/main/AndroidManifest.xml" target="_blank" rel="noopener">AndroidManifest.xml</a>. Be sure to relpace the <b>[PROJECT_ID]</b> string with your actual Appwrite project ID. You can find your Appwrite project ID in you project settings screen in your Appwrite console.</p>
6837

@@ -83,6 +52,27 @@ $version = (isset($versions['flutter'])) ? $versions['flutter'] : '';
8352
</code></pre>
8453
</div>
8554

55+
<h3>iOS</h3>
56+
57+
<p>For <b>iOS</b> first add your app <u>name</u> and <u>Bundle ID</u>, You can find your Bundle Identifier in the General tab for your app's primary target in Xcode.</p>
58+
59+
<p>The Appwrite SDK uses ASWebAuthenticationSession on iOS 12+ and SFAuthenticationSession on iOS 11 to allow OAuth authentication. You have to change your iOS Deployment Target in Xcode to be iOS >= 11 to be able to build your app on an emulator or a real device.</p>
60+
61+
<ol class="margin-top margin-bottom-large">
62+
<li class="margin-bottom-small">In Xcode, open Runner.xcworkspace in your app's ios folder.
63+
<li class="margin-bottom-small">To view your app's settings, select the Runner project in the Xcode project navigator. Then, in the main view sidebar, select the Runner target.</li>
64+
<li class="margin-bottom-small">Select the General tab.</li>
65+
<li class="margin-bottom-small">In Deployment Info, 'Target' select iOS 11.0</li>
66+
</ol>
67+
68+
<h3>Linux</h3>
69+
70+
<p>For <b?>Linux</b> add your app <u>name</u> and <u>package name</u>, Your package name is generally the <b>name</b> in your href="https://github.com/appwrite/playground-for-flutter/blob/0fdbdff98384fff940ed0b1e08cf14cfe3a2be3e/pubspec.yaml#L1" target="_blank" rel="noopener">pubspec.yaml</a> file. If you cannot find the correct package name, run the application in linux, and make any request with proper exception handling, you should get the application id needed to add in the received error message.</p>
71+
72+
<h3>Mac OS</h3>
73+
74+
<p>For <b>Mac OS</b> add your app name and Bundle ID, You can find your Bundle Identifier in the General tab for your app's primary target in Xcode.</p>
75+
8676
<h3>Web</h3>
8777

8878
<p>Appwrite 0.7, and the Appwrite Flutter SDK 0.3.0 have added support for Flutter Web. To build web apps that integrate with Appwrite successfully, all you have to do is add a web platform on your Appwrite project's dashboard and list the domain your website will use to allow communication to the Appwrite API.</p>
@@ -92,6 +82,28 @@ $version = (isset($versions['flutter'])) ? $versions['flutter'] : '';
9282
<p>While running Flutter Web, make sure your Appwrite server and your Flutter client are using the same top-level domain and the same protocol (HTTP or HTTPS) to communicate. When trying to communicate between different domains or protocols, you may receive HTTP status error 401 because some modern browsers block cross-site or insecure cookies for enhanced privacy. In production, Appwrite allows you set multiple <a href="/docs/custom-domains">custom-domains</a> for each project.</p>
9383
</div>
9484

85+
86+
<h3>Windows</h3>
87+
88+
<p>For <b>Windows</b> add your app <u>name</u> and <u>package name</u>, Your package name is generally the <b>name</b> in your href="https://github.com/appwrite/playground-for-flutter/blob/0fdbdff98384fff940ed0b1e08cf14cfe3a2be3e/pubspec.yaml#L1" target="_blank" rel="noopener">pubspec.yaml</a> file. If you cannot find the correct package name, run the application in windows, and make any request with proper exception handling, you should get the application id needed to add in the received error message.</p>
89+
90+
91+
<h2><a href="#getSDK" id="getSDK">Get Appwrite Flutter SDK</a></h2>
92+
93+
<p>Add <a href="https://pub.dev/packages/appwrite" target="_blank" rel="noopener">Appwrite SDK</a> to your package's pubspec.yaml file <a href="https://github.com/appwrite/playground-for-flutter/blob/master/pubspec.yaml" target="_blank" rel="noopener">(view example)</a>:</p>
94+
95+
<div class="ide margin-bottom" data-lang="yaml" data-lang-label="yaml">
96+
<pre class="line-numbers"><code class="prism language-yaml" data-prism>dependencies:
97+
appwrite: ^<?php echo $this->escape($version); ?>
98+
</code></pre>
99+
</div>
100+
101+
<p>You can also install the SDK using the <a href="https://pub.dev/" target="_blank" rel="noopener">Dart package manager</a> from your terminal:</p>
102+
103+
<div class="ide margin-bottom" data-lang="bash" data-lang-label="Bash">
104+
<pre class="line-numbers"><code class="prism language-bash" data-prism>pub get appwrite</code></pre>
105+
</div>
106+
95107
<h2><a href="#initSDK" id="initSDK">Init your SDK</a></h2>
96108

97109
<p>Initialize your SDK code with your project ID, which can be found in your project settings page.</p>

0 commit comments

Comments
 (0)