The BuzzBox SDK enables you to easily add a scheduler to your App. With few lines of code you can add a background task and app-side notifications. Besides, BuzzBox SDK also include free realtime analytics, so you can monitor in real time how many user are installing and using your App. Notifications and Analytics are tighly integrated, but you can use only want you need. The developer needs to do very little work to provide value to the user and also increase retention, visits/user and perceived value of the product. The app-side notifications do not require any server side code, so the implementation costs are minimal. The SDK is modularized, so it can be customized by the developer.
BuzzBox SDK has below features:-
Scheduler:
It allows you to run a background task up to every minute according to a cron string (i.e. "0 8-19 1,2,3,4,5" will run every hour, from 8am to 7pm, Monday - Friday).
Notifications Settings:
It has advanced notification settings with optional configurable UI for users.
Integrated Rss Parser:
It give you the possibility to monitor whatever Rss feed providing you an implemented Rss Parser Task.
Notifications Log:
You can check if and when yours backgrounds task are running.
Notification Types:
Your app can support different type of notifications configurable by the user through the easy and completed UI.
Refer the below link for complete sample code:-
Download Sample Code
Have a look on few code snippets,
AndroidManifest.xml
ReminderTask.java
HelloWorldActivity.java
main.xml
BuzzBox SDK has below features:-
Scheduler:
It allows you to run a background task up to every minute according to a cron string (i.e. "0 8-19 1,2,3,4,5" will run every hour, from 8am to 7pm, Monday - Friday).
Notifications Settings:
It has advanced notification settings with optional configurable UI for users.
Integrated Rss Parser:
It give you the possibility to monitor whatever Rss feed providing you an implemented Rss Parser Task.
Notifications Log:
You can check if and when yours backgrounds task are running.
Notification Types:
Your app can support different type of notifications configurable by the user through the easy and completed UI.
Refer the below link for complete sample code:-
Download Sample Code
Have a look on few code snippets,
AndroidManifest.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.buzzbox.demo.helloworld" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="3" /> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-permission android:name="android.permission.VIBRATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <application android:icon="@drawable/icon_notification_cards_clubs" android:label="@string/app_name"> <activity android:name=".HelloWorldActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="com.buzzbox.mob.android.scheduler.NotificationClickActivity"/> <activity android:name="com.buzzbox.mob.android.scheduler.ui.SchedulerPreferenceActivity"/> <activity android:name="com.buzzbox.mob.android.scheduler.ui.SchedulerLogActivity"/> <receiver android:name="com.buzzbox.mob.android.scheduler.BootReceiverSchedulerManager"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED"/> </intent-filter> </receiver> <receiver android:name="com.buzzbox.mob.android.scheduler.TimeChangeReceiver"> <intent-filter> <action android:name="android.intent.action.TIME_SET"/> <action android:name="android.intent.action.DATE_CHANGED"/> <action android:name="android.intent.action.TIMEZONE_CHANGED"/> </intent-filter> </receiver> <receiver android:name="com.buzzbox.mob.android.scheduler.AlarmReceiver"/> <service android:name="com.buzzbox.mob.android.scheduler.ScheduledService"/> <meta-data android:name="Scheduler.Analytics.apiKey" android:value="debug-api-key"/> <!-- sign up at http://hub.buzzbox.com and get your ApiKey --> </application> </manifest> |
ReminderTask.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | import android.content.ContextWrapper; import com.buzzbox.mob.android.scheduler.NotificationMessage; import com.buzzbox.mob.android.scheduler.Task; import com.buzzbox.mob.android.scheduler.TaskResult; /** * Recurring Task that implements your business logic. * The BuzzBox SDK Scheduler will take care of running the doWork method according to * the scheduling. * */ public class ReminderTask implements Task { @Override public String getTitle() { return "Reminder"; } @Override public String getId() { return "reminder"; // give it an ID } @Override public TaskResult doWork(ContextWrapper ctx) { TaskResult res = new TaskResult(); // TODO implement your business logic here // i.e. query the DB, connect to a web service using HttpUtils, etc.. NotificationMessage notification = new NotificationMessage( "HB Demo", "Don't forget to open HB Demo App"); notification.notificationIconResource = R.drawable.icon_notification_cards_clubs; notification.setNotificationClickIntentClass(HelloWorldActivity.class); res.addMessage( notification ); return res; } } |
HelloWorldActivity.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.Window; import android.widget.Button; import com.buzzbox.mob.android.scheduler.SchedulerManager; import com.buzzbox.mob.android.scheduler.analytics.AnalyticsManager; import com.buzzbox.mob.android.scheduler.ui.SchedulerLogActivity; public class HelloWorldActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.main); // 1. call BuzzBox Analytics int openAppStatus = AnalyticsManager.onOpenApp(this); // 2. add the Task to the Scheduler if (openAppStatus==AnalyticsManager.OPEN_APP_FIRST_TIME) { // register the Task when the App in installed SchedulerManager.getInstance().saveTask(this, "*/1 * * * *", // a cron string ReminderTask.class); SchedulerManager.getInstance().restart(this, ReminderTask.class ); } else if (openAppStatus==AnalyticsManager.OPEN_APP_UPGRADE){ // restart on upgrade SchedulerManager.getInstance().restartAll(this, 0); } // 3. set up UI buttons Button settingsButton = (Button) findViewById(R.id.settings); settingsButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { SchedulerManager.getInstance() .startConfigurationActivity(HelloWorldActivity.this, ReminderTask.class); } }); Button log = (Button) findViewById(R.id.log); log.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(HelloWorldActivity.this, SchedulerLogActivity.class); startActivity(intent); } }); Button refresh = (Button) findViewById(R.id.notify); refresh.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { SchedulerManager.getInstance().runNow(HelloWorldActivity.this, ReminderTask.class, 0); } }); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (SchedulerManager.SCHEDULER_CONFIG_REQ_CODE == requestCode && data!=null) { SchedulerManager.getInstance() .handleConfigurationResult(this, data); } } } |
main.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="HB Demo" android:textSize="16sp" android:gravity="center_horizontal" android:textColor="#53B9FA" android:paddingTop="9dip" /> <Button android:id="@+id/settings" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Notification Settings" android:layout_margin="7dip"/> <Button android:id="@+id/log" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Scheduler Log" android:layout_margin="7dip"/> <Button android:id="@+id/notify" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Notify Me!" android:layout_margin="7dip"/> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="HB Demo" android:textSize="16sp" android:gravity="center_horizontal" android:textColor="#aaaaaa" android:layout_marginTop="10dip" /> </LinearLayout> </ScrollView> |
No comments:
Post a Comment