Last active
October 13, 2015 12:38
-
-
Save akalipetis/4197445 to your computer and use it in GitHub Desktop.
Code to be inserted for Warply SDK Integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- For Warply --> | |
<!-- Activity used for displaying Warply Campaigns. --> | |
<activity android:name="ly.warp.sdk.WarpViewActivity" /> | |
<!-- Service used for handling Push Notifications. --> | |
<!-- If custom Push functionality is needed, replace this with your implementation. --> | |
<service android:name="ly.warp.sdk.WarpIntentService" /> | |
<!-- Service used for updating user's location. --> | |
<service android:name="ly.warp.services.UpdateUserLocationService" /> | |
<!-- Receiver used for receiving GCM Push Notifications. --> | |
<receiver | |
android:name="ly.warp.sdk.GCMBroadcastReceiver" | |
android:permission="com.google.android.c2dm.permission.SEND" > | |
<intent-filter> | |
<action android:name="com.google.android.c2dm.intent.RECEIVE" /> | |
<action android:name="com.google.android.c2dm.intent.REGISTRATION" /> | |
<category android:name="YOUR.PACKAGE.HERE" /> | |
</intent-filter> | |
</receiver> | |
<!-- Receiver used for listening to location changes. --> | |
<receiver android:name="ly.warp.receivers.LocationChangedReceiver" /> | |
<!-- Receiver used for listening to connectivity changes. --> | |
<receiver android:name="ly.warp.receivers.ConnectivityChangedReceiver" > | |
<intent-filter> | |
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> | |
</intent-filter> | |
</receiver> | |
<!-- Metadata containing your application's UUID, got from Warply backend. --> | |
<meta-data | |
android:name="warp_uuid" | |
android:value="YOUR_APP_UUID_HERE" /> | |
<!-- Metadata declaring if Warply logs should be printed. If not present, default is true. --> | |
<!-- Consider swithing to false for publishing. --> | |
<meta-data | |
android:name="warp_debug_mode" | |
android:value="true" /> | |
<!-- End for Warply --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- For Warply --> | |
<!-- Used to communicate with Warply servers --> | |
<uses-permission android:name="android.permission.INTERNET" /> | |
<!-- Location is only accessed if set in the Warply backend --> | |
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | |
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | |
<!-- Used by GCM Push Notifications --> | |
<uses-permission android:name="android.permission.WAKE_LOCK" /> | |
<uses-permission android:name="android.permission.GET_ACCOUNTS" /> | |
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> | |
<uses-permission android:name="YOUR.PACKAGE.HERE.permission.C2D_MESSAGE" /> | |
<!-- Used for better device profiling --> | |
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> | |
<!-- Used for network statistics and switching off Warply when network is not available --> | |
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | |
<!-- Declaring this permission makes sure no other application has access to your GCM Push Notifications --> | |
<permission | |
android:name="YOUR.PACKAGE.HERE.permission.C2D_MESSAGE" | |
android:protectionLevel="signature" /> | |
<!-- End for Warply --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public View getView(int position, View convertView, ViewGroup parent) { | |
// Initialize a new convertView, or get the recycled one | |
// Get references to the needed views: title, subtitle, hidden, date, image | |
Campaign c = mCampaigns.get(position); | |
title.setText(c.getTitle()); | |
subtitle.setText(c.getSubtitle()); | |
hidden.setText(c.getMessage()); | |
java.text.DateFormat format = DateFormat.getMediumDateFormat(mContext); | |
date.setText(format.format(c.getExpires())); | |
ImageLoadingTask task = new ImageLoadingTask(image); | |
task.execute(c.getImageUrl()); | |
return convertView; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void onListItemClick(ListView l, View v, int position, long id) { | |
super.onListItemClick(l, v, position, id); | |
Campaign c = (Campaign) mAdapter.getItem(position); // Get clicked campaign here | |
Intent i = WarpViewActivity.createIntentFromSessionUUID(this, c.getSessionUUID()); | |
startActivity(i); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Warply.getInbox(CallbackReceiver); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState | |
setContentView(R.layout.activity_main); | |
// Initialization code here | |
Warply.init(Context); | |
// Additional Warply code here | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onFailure(int errorCode); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onStart() { | |
super.onStart(); | |
WarplySessionManager.onStartActivity(this); | |
} | |
@Override | |
protected void onStop() { | |
super.onStop(); | |
WarplySessionManager.onStopActivity(this); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onSuccess(CampaignList list); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState | |
setContentView(R.layout.activity_main); | |
// Initialization code here | |
Warply.init(Context); | |
// This is the project ID, from the project you create at Google API Console | |
Warply.registerGCM("project_id"); | |
// Additional Warply code here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment