~~Title:Cobub Toaster Android Developer Guide - Mobile Apps Marketing Platform of Open Source - Mobile Analytics & Mobile Push Notification Solutions - Cobub Mobile Developer Center~~ {{description>Cobub Razor is an Open Source Mobile Analytics. Android Developer Guide.}} {{keywords>Cobub Razor,open source mobile analytics,mobile analytics,mobile app analytics, android, developer guide}} ====== Android Developer Guide ====== Compatibility Information * Compatible with Android 2.2 and above (API 8 and above) * SDK Version v1.0 ===== Integration Guide ===== Modifiy **AndroidManifest.xml** Add Permission Add components **Add the code** Call the following API as soon as possible after starting app: CPushInterface.initPushService(Context ctx, String UID, String host, int port); ===== API Reference ===== **Initialize** CPushInterface.initPushService(Context ctx, String UID, String host, int port); * ctx: context parameter * UID: UID of the device, mandatory * host: PNS url or IP address * port: PNS binding port **Set Channel** This method sets tag value for terminal device. CPushInterface.setChannel(Context ctx, String channelName); * ctx:context parameter * channelName:channel value, here is a tag for termianl, for example “location:Beijing” **Read feedback** Report to PNS that notification has been clicked (read). CPushInterface.sendReadFeedback(Context context, String mid, String expired); * ctx:context parameter * mid:mid in pushed message * expired:expired time in pushed message **Receive Push Content** The payload message is transferred via Broadcast. It’s needed to set a BroadcastReceiver to receive, and the Receiver needs to filter their app package name (package) of action, otherwise it can not receive the message, add the following to menifest: The data form PNS to mobile device contains the following content: mid:“XXXXXX” data:“XXXXXX” expired:“XXXXXX” channel:“XXXXXXXX” In Receiver the field can be retrieved by the following methods: String msg = intent.getStringExtra("data"); String expired = intent.getStringExtra("expired"); String mid = intent.getStringExtra("mid"); Call according to the need Read feedback interface.