Realtime modular applications on Android: auto-updating, analytics, and more.
See silo-server for server implementation written in Go.
Download the *.aar bundle here.
Bundled with aarpack, a simple tool to transport Android Libraries.
- Add the Silo services (base, upstream, and downstream) and any modules you'd like to your Manifest (such as Blaise).
<service
android:name="com.farazfazli.blaise.BlaiseService" />
<service
android:name="com.farazfazli.silo.SiloService" />
<service
android:name="com.farazfazli.silo_downstream.DownstreamService" />
<service
android:name="com.farazfazli.silo_upstream.UpstreamService" />
- Include Silo and any modules (such as Blaise).
compile project(path: ':blaise')
compile project(path: ':silo')
- Bind reflected fragments using the "getFragments" helper method.
public void bindFragments() {
HashMap<String, Fragment> fragments = getFragments(new String[]{"SettingsFragment"});
mSettingsFragment = fragments.get("SettingsFragment");
// You can now use mSettingsFragment however you want
}
- Load necessary Silo modules.
// Load each module in modules array, start Blaise to check for updates
private void loadSiloModules() {
String[] modulesArray = new String[]{BlaiseService.MODULE_NAME};
Intent silo = SiloService.getIntent(this, modulesArray);
blaise = BlaiseService.getIntent(this, true);
startService(silo);
registerUpdate(); // Register receiver here if you want updates to be posted to UI (optional)
startService(blaise);
}
- Add local broadcast receiver, and override onStop & onDestroy. (optional)
private void registerUpdate() {
Log.i(TAG, "Receiver being registered");
IntentFilter updateFilter = new IntentFilter(Constants.UPDATE_BROADCAST);
updateReceived = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Log.i(TAG, "Received broadcast, binding new views");
bindFragments();
}
};
LocalBroadcastManager.getInstance(this).registerReceiver(updateReceived, updateFilter);
}
@Override
protected void onStop() {
if (updateReceived != null) {
LocalBroadcastManager.getInstance(this).unregisterReceiver(updateReceived);
}
super.onStop();
}
@Override
protected void onDestroy() {
stopService(blaise);
super.onDestroy();
}
- Capture analytics data (adding to dashboard to be developed)
SiloService.addMessageToQueue("Loading fragment from external APK");
- Include the Blaise Plugin module
compile project(path: ':blaise-plugin')
- Extend PluginFragment
public class SettingsFragment extends PluginFragment
- Replace inflater to allow for reflected fragments to be loaded
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return resources != null ? inflater.inflate(getLayout(BuildConfig.APPLICATION_ID, "fragment_settings"), container, false) : null;
}
-
Make an account by hosting your own instance and filling the appropriate fields.
-
Update through the site, all clients will autoupdate.
I was motivated by low adoption of user updates and as a developer, I want each and every one of my app users to have the latest app code.
Analytics, audience segmentation, A/B testing. I am thinking to do this in R.
Feel free to open a GitHub issue for any bugs you find, or suggestions you have.
Apache
Email me at farazfazli@gmail.com if you'd like to contact me. And if you're using this library, I'd love to hear from you and try out your app!