<commit_before>---
layout: post
title:  "android implementing greenrobot greendao ORM for your sqlite"
date:   2017-01-16 07:07:19
categories: [android, sqlite, database]
comments: true
---



I have been a fan of Firebase since it was launched and started using this wonderful real-time database platform fully since May 2016 for mobile applications I developed.
Though there are some limitations that i have noticed, For example triggering a app to app notification. So we will be implementing a firebase app to app notification without implementing a server backend.
<!--more-->

### What Firebase Provides
Currently via the firebase console all you can do is send push notification to devices only from the console.

![Firebase Console Image](/img/console_notification.png)


### Limitation
We can't programmatically trigger a push notification to a particular device.


### What we want to achieve
We want to be able to notify another device directly of a new notification without having to implement a server side backend to send push notification. So we will be using the firebase database to achieve that

### Steps to achieve this 
* We are going to create a notifications node on our firebase database
* Every user will listen to their notifications node for on child_added events. That is we will have /notifications/user_id/ (notification-objects)
* Then write a service in our android app that listens to the logged in user's notification node for new data
* When a new notification is added against the user's id we then show an android notification to alert the user on the app.

See firebase structure below<commit_msg>updating title<commit_after>---
layout: post
title:  "Android Implementing Greenrobot Greendao ORM for Your Sqlite"
date:   2017-01-16 07:07:19
categories: [android, sqlite, database]
comments: true
---



I have been a fan of Firebase since it was launched and started using this wonderful real-time database platform fully since May 2016 for mobile applications I developed.
Though there are some limitations that i have noticed, For example triggering a app to app notification. So we will be implementing a firebase app to app notification without implementing a server backend.
<!--more-->

### What Firebase Provides
Currently via the firebase console all you can do is send push notification to devices only from the console.

![Firebase Console Image](/img/console_notification.png)


### Limitation
We can't programmatically trigger a push notification to a particular device.


### What we want to achieve
We want to be able to notify another device directly of a new notification without having to implement a server side backend to send push notification. So we will be using the firebase database to achieve that

### Steps to achieve this 
* We are going to create a notifications node on our firebase database
* Every user will listen to their notifications node for on child_added events. That is we will have /notifications/user_id/ (notification-objects)
* Then write a service in our android app that listens to the logged in user's notification node for new data
* When a new notification is added against the user's id we then show an android notification to alert the user on the app.

See firebase structure below
{'fraction_non_alphanumeric': 0.04524610210944665, 'fraction_numerical': 0.011005808621216754, 'mean_word_length': 4.527027027027027, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3024094', 'n_tokens_mistral': 800, 'n_tokens_neox': 743, 'n_words': 488}