https://github.com/stanwood/crm_framework_android
https://github.com/stanwood/crm_framework_android
android
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/stanwood/crm_framework_android
- Owner: stanwood
- License: mit
- Created: 2018-05-30T12:28:57.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-05T08:34:17.000Z (over 6 years ago)
- Last Synced: 2025-01-09T08:15:17.370Z (9 months ago)
- Topics: android
- Language: Java
- Size: 183 KB
- Stars: 0
- Watchers: 8
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CRM Framework (Android)
[](https://jitpack.io/#stanwood/CRM_Framework_android)
This library contains easy to implement support for firebase push notifications. It uses Analytics Framework (https://github.com/stanwood/Analytics_Framework_android) to track application data which can be used for generating CRM campaigns.
## Motivation
The motivation of this framework is to ease the implementation of push notification implementation. The notifications and inapp messages are triggered based on firebase data tracked by analytics framework. This data can be used to create funnels and creating CRM campaigns.## Requirements
- Integrated Analytics Framework
- Sample app needs to integrate firebase. Please remember to add google-services.json to the project.## Import
//TODO## Integration
1. Init CRM class in your application's `onCreate()` method and pass to it application context and instance of BaseAnalyticsTracker.
CRM class is used for passing the push token to the tracking library.
```java
Crm.init(this, SimpleAppTracker.instance());
```2. Create a concrete implementation of `BaseNotificationHandler` and override `createNotification()`.
`createNotification()` is called after receiving the push notification and is responsible for handling its display.
```java
@Override
public void createNotification() {
//Creating default notification chanel based on crm.xml configuration
NotificationManager notificationManager = createDefaultNotificationChannel();
//Specifying intent of target activity
Intent intent = new Intent(getContext(), MainActivity.class);
//Creating default notification builder
NotificationCompat.Builder builder = createDefaultNotificationBuilder(intent, getTitle(), getMessage());
//Sending notification
sendNotification(notificationManager, builder);
}
```3. Create a concrete implementation of `BaseMessagingService` override `createBaseNotificationHandler()` and return a new instance of Notification Handler from step 2.
```java
@NonNull
@Override
public BaseNotificationHandler createBaseNotificationHandler() {
return new CrmNotificationsHandler(getApplication(), SimpleAppTracker.instance());
}
```4. Register the service in your application manifest.
```java
```5. In App messages exemplar implementation. InApp messages are received as a silent push notifications and stored for later use.
On start of every screen `displayInAppIfAny()` is checking if there are any pending messages for specific screen to be displayed.
```java
/**
* Exemplar implementation. Same can be done with Fragments.
* The important part is to check if there are any inApp messages to be displayed for the current screen.
*/
public abstract class BaseActivity extends AppCompatActivity {protected abstract String getScreenName();
@Override
public void onStart() {
super.onStart();
if (!TextUtils.isEmpty(getScreenName())) {
//Check if there are any screens to be displayed for specific screen
Crm.getInstance().displayInAppIfAny(this, getScreenName());
//Sample implementation of analytics framework needed for creating funnel based CRM
//campaigns in order to increase re-targeting.
SimpleAppTracker.instance().trackScreenView(getScreenName());
}
}
}
```6. (Optional) create crm.xml file with custom specifications
```xml
chanel_id
Notifications Description
link
title
message
messageBig
messageId
#FF4081
type
target_screen```
7. (Optional) Specifying different designs for inApps messages based on the screen name in your application's `onCreate()` method:
```java
Crm.getInstance().addDialogDesign("main_view", CustomInAppDialogFragment.class);
```Alternatively extended method can be used in order to display a custom InAppDialogFragment implementation.
```java
Crm.getInstance().displayInAppIfAny(this, getScreenName(), new CustomInAppDialogFragment());
```## Campaign tool (under development)
Campaign tool can be found:
- https://stanwood-crm.appspot.com/campaigns - very dummy implementation
- stub for firing event with debug information: https://stanwood-crm.appspot.com/event?user_email=zyzniewski@gmail.com - basically any GET params are injected into `user_properties`