Difference between revisions of "KiwixKolibri"

Jump to navigation Jump to search
added sample code that could be useful for Kiwix<-->Kolibri initegration on Android
(Added some additional content channel IDs)
(added sample code that could be useful for Kiwix<-->Kolibri initegration on Android)
Line 68: Line 68:


=== Integration on Android ===
=== Integration on Android ===
Using [https://developer.android.com/reference/android/content/Intent.html Intents] to cross-reference between the platforms
Using Intents to cross-link between the Kolibri and Kiwix apps. Useful links:
 
# [https://developer.android.com/training/basics/intents/index.html Intent basics]
# [https://developer.android.com/reference/android/content/Intent.html Intent class]
# [https://developer.android.com/guide/components/intents-filters.html intent-filters]
# [https://developer.android.com/guide/components/intents-common.html#Camera list] of "common" intents, for example Camera
# we're interested in the ACTION_VIEW intent: [https://developer.android.com/reference/android/content/Intent.html#getScheme() ACTION VIEW], the view's URI can be resolved with a custom schema
# [https://tech.just-eat.com/2015/06/29/deep-linking-in-android-the-easy-way/ Article about ACTION_VIEWs] using a custom scheme
 
From my limited understanding, we can define two custom `scheme`s such that:
  - ACTION_VIEW intents that start with `kolibri://<path>` will be handled by the Kolibiri app,
  - and ACTION_VIEW intents starting with `kiwix://<path>` will be handled by the Kiwix app,
 
We could something like this in the Kolibri android app manifest need:
<nowiki>
    <activity
        android:name=".activities.LinkDispatcherActivity"
        android:noHistory="true"
        android:launchMode="singleInstance"
        android:theme="@android:style/Theme.NoDisplay" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <category android:name="android.intent.category.BROWSABLE"/>
            <data android:scheme="kolibri"/>
            <data android:host="view_channel"/>
            <data android:host="view_node"/>
            <data android:pathPattern=".*"/>
        </intent-filter>
    </activity>
</nowiki>
 
in the Kiwix android app
<nowiki>
    <activity
        android:name=".activities.LinkDispatcherActivity"
        android:noHistory="true"
        android:launchMode="singleInstance"
        android:theme="@android:style/Theme.NoDisplay" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <category android:name="android.intent.category.BROWSABLE"/>
            <data android:scheme="kiwix"/>
            <data android:host="view_zimfile"/>
            <data android:host="view_page"/>
            <data android:pathPattern=".*"/>
        </intent-filter>
    </activity>
</nowiki>


== Stickers & Swag ==
== Stickers & Swag ==
16

edits

Navigation menu