background image

6

APK shared preferences handling with configura on script

An APK can be designed to share some preferences which can be then read or wri en by the 

 Qeedji System 

 service:

either through the configura on script,

or through the device configura on Web interface¹.

¹ 

Should be available Q1/2021.

The APK must link the 

tech-qeedji-system-lib-classes.jar

 Java library.

The APK must also implement a child class of the 

SharedPreferenceAPI

 class supported in the 

tech-qeedji-system-lib-classes.jar

 Java library.

package tech.qeedji.test1; 

import tech.qeedji.system.lib.SharedPreferenceAPI; 

public class MySharedPreferenceAPI extends SharedPreferenceAPI { 

   @Override 

   public String getPreferenceAuthority() { 

       return BuildConfig.APPLICATION_ID; 

   } 

   @Override 

   public Object[][] initPreferences() { 

       Object[][] preferences = { 

           // filename, key, access, type, default_value 

           {"test1", "test1Integer", "rw", int.class, 1}, 

           {"test1", "test1Long", "rw", long.class, 10000000L}, 

           {"test1", "test1Float", "rw", float.class, 0.897546F}, 

           {"test1", "test1Boolean", "rw", boolean.class, true}, 

           {"test1", "test1String", "rw", String.class, "test1StringValue"}, 

           {"test1", "test1StringSet", "rw", String[].class, new String[]{"http://Val0", "http://Val1", "http://Val2"}}, 

       }; 

       return preferences; 

   } 

The APK must declare a provider in its manifest.

<?xml version="1.0" encoding="utf-8"?> 

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 

   package="tech.qeedji.test1"> 

   <application 

       android:icon="@mipmap/ic_launcher" 

       android:label="@string/app_name" 

       android:roundIcon="@mipmap/ic_launcher_round" 

       android:theme="@style/AppTheme"> 

       <activity android:name=".MainActivity"> 

           <intent-filter> 

               <action android:name="android.intent.action.MAIN" /> 

               <category android:name="android.intent.category.LAUNCHER" /> 

           </intent-filter> 

       </activity> 

       <provider android:name="tech.qeedji.test1.MySharedPreferenceAPI" 

           android:authorities="tech.qeedji.test1" 

           android:multiprocess="false" 

           android:exported="true" 

           android:singleUser="false" 

           android:initOrder="100" 

           android:visibleToInstantApps="true"/> 

   </application> 

</manifest> 

Extract example from a configura on script:

Android.Preferences("SharedPreferences", "tech.qeedji.test1", "test1").setInt("test1Integer", 8); 

Android.Preferences("SharedPreferences", "tech.qeedji.test1", "test1").setLong("test1Long", 99999999); 

Android.Preferences("SharedPreferences", "tech.qeedji.test1", "test1").setFloat("test1Float", 0.123456); 

Android.Preferences("SharedPreferences", "tech.qeedji.test1", "test1").setBoolean("test1Boolean", false); 

Android.Preferences("SharedPreferences", "tech.qeedji.test1", "test1").setString("test1String", "Newtest1StringValue"); 

Android.Preferences("SharedPreferences", "tech.qeedji.test1", "test1").setStringArray("test1StringSet", ["http://NewVal0", "http://NewVal1", "http://NewVal2"]); 

Summary of Contents for TAB10s

Page 1: ...Developer manual 001H AOSP 9 10 10 TAB10s 8 30 ...

Page 2: ...la on is of the utmost importance Incorrect fi ng and or installa on may result in personal injury or loss Qeedji disclaims all liability of whatever kind if the product is assembled fi ed and or installed in an incorrect manner Do not use the product near a water supply Do not pour anything on the product like flammable liquids or material Do not expose the product to direct sun near a hea ng source...

Page 3: ...3 1 1 1 2 1 3 1 4 1 4 1 1 4 2 1 5 2 1 Table of content Part I Introduc on APK Development System APK signing Qeedji System service Installa on by USB AOSP device mode Qeedji preferences Part II Contacts ...

Page 4: ...dji TAB10s and who already have Android APK development skills It is recommended to read first the TAB10s user manual Demo Package Content Items Descrip on Quan ty TAB10s Qeedji tablet embedding AOSP 1 Power supply USB Type C 1 USB Type C cable Cable Assembly Type C Male to Type A Male 1 USB hub USB Type A 2 0 USB Type C 1 ...

Page 5: ...ch qeedji host webview aar Android library exposes an Javascript API for specific func onali es in a WebView The tech qeedji host webview aar Android library embeds the tech qeedji system lib classes jar library String Host Bluetooth getHardwareAddress String Host Device getModel String Host Device getManufacturer String Host Device getSerial String Host Device getPsn String Host Device getSoftware...

Page 6: ...der in its manifest xml version 1 0 encoding utf 8 manifest xmlns android http schemas android com apk res android package tech qeedji test1 application android icon mipmap ic_launcher android label string app_name android roundIcon mipmap ic_launcher_round android theme style AppTheme activity android name MainActivity intent filter action android name android intent action MAIN category android ...

Page 7: ... surround_light APK allows to set the surround light color and state with steady green steady orange steady red off This APK uses the SurroundLight class described in the specific API device_info APK displays device informa ons This APK uses the android os Build APIs NetworkInterface and the DipSwitch class described in the specific API These permissions are required READ_PHONE_STATE READ_PRIVILEGED_...

Page 8: ...er load an URL This APK uses the WebView API and the tech qeedji host webview aar Android library for Qeedji The RECEIVE_BOOT_COMPLETED and INTERNET permissions are required This APK has system privileges A specific 000000000000 js configura on script allows to configure the URL launcher APK set URL set login creden als Several websites examples are available on Qeedji github for TAB10s Designing an ...

Page 9: ...lug to the TAB10s USB C connector Then wait for the TAB10s is boo ng up Go in the Settings applica on and configure the WLAN LAN debug Prerequisite have a suitable Ethernet to USB USB C or POGO type connector bridge which is connected to the LAN network Connect the Ethernet to USB bridge to on the TAB10s USB C or POGO type connector Debug mode se ng Launch the Settings applica on press on the About...

Page 10: ...me applicant iden fica on used to digitally sign the request Thanks to match the filename pa ern by replacing contoso by your own organiza on name For example openssl req new key contoso_private_key_for_android key subj C US ST California L San Francisco O Contoso OU Contoso_ISD CN CISO emailAddress ciso contoso com contoso for_qeedji_aosp csr 3 SEND YOUR CSR TO QEEDJI Once generated send a email to...

Page 11: ... app_name android roundIcon mipmap ic_launcher_round android supportsRtl true android theme style AppTheme activity android name MainActivity intent filter action android name android intent action MAIN category android name android intent category LAUNCHER intent filter activity application manifest 2 SIGN THE APPLICATION WITH YOUR SYSTEM JAVA KEYSTORE When crea ng the APK sign the APK with your ...

Page 12: ...on of the TAB10s This service allows to install one or more APK by USB storage device inser on update the AOSP firmware by USB storage device inser on configure the product with a Javascript file by USB storage device inser on by DHCP code 66 This service allows also to configure the AOSP device mode as soon as the device has started ...

Page 13: ...nt the line disableExternalStorageCopyApk in the configura on script then follow the configuration by USB procedure If the USB storage device contains several APK at the root each APK is installed in alphabe cal order AOSP firmware upgrade Copy the AOSP firmware zip on the root directory of the USB storage device Insert the USB storage device in the TAB10s and follow the instruc ons on the screen For...

Page 14: ...the default AOSP device mode is native If the persist sys device_mode system property value is kiosk the SystemUI service inhibits the system bars and the Launcher3 service hides the AllApps view and the Op onsPopupView dialog box The persist sys device_mode system property can be changed by using the configura on script native setDeviceModeNative default mode setDeviceModeKiosk kiosk setDeviceMode...

Page 15: ... preference value is true the APK installa on from the root of the USB storage is authorized Shared preferences for the URL Launcher APK The shared preferences for URL Launcher APK is stored in the tech qeedji url_launcher prefs xml file In case login creden als are required to connect to the URL an addi onal shared preferences tech qeedji url_launcher credential credential_label prefs xml file is r...

Page 16: ...refs Type R W Default value Values Descrip on type String RW HttpAuth HttpAuth Define the creden al type username String RW Define the URL creden al username password String WO Define the URL creden al password In this version only the HttpAuth value is possible ...

Page 17: ...er to the Qeedji Website for FAQ applica on notes and so ware downloads h ps www qeedji tech Qeedji FRANCE INNES SA 5A rue Pierre Joseph Colin 35700 RENNES Tel 33 0 2 23 20 01 62 Fax 33 0 2 23 20 22 59 Qeedji GERMANY INNES SA Verbindungsbüro Deutschland Lebacher Str 4 66113 Saarbrücken Tel 09386 979 39 14 Fax 09386 979 39 15 Mob 0175 853 67 81 ...

Reviews: