See Hipmob in action on iOS with Wanderplayer and Android with Wanderplayer
Hipmob For iPhone & iPad
Overview
15-minute integration on iPhone
- Add a new app in your Hipmob account. Once this is done, we'll generate a Mobile Key for your app. Remember this - you'll be using it shortly.
- In the Link Binary with Libraries section of your project's Build Phases you'll need to add the following Framework Dependencies:
- libicucore.dylib
- CFNetwork.framework
- Security.framework
- Foundation.framework
- We use Objective-C categories in the Hipmob framework, so you will need to go to your project's Build Settings and add -force_load to the Other Linker Flags field.
-
Download the Hipmob iOS Framework
. This includes all the dependencies required (see the Framework Options section for more details).
Note The Hipmob iOS framework currently only supports iOS 4.3 or higher (the armv7/armv7s architectures). We provide a universal library with support for running the Hipmob code in the simulator as well. - Copy the Hipmob framework folder into your project by dragging the hipmob.framework directory into your Xcode project. Make sure you select the "Copy items into destination group's folder (if needed)" option. Once you have done this, open your build phases (under your project's Build Settings screen) and add the resources from inside the framework into the Copy Bundle Resources section: you will need to select the images used for buttons and backgrounds, but NOT the hipmob.h header file.
-
Include the hipmob header wherever you will be creating hipmob viewcontroller.
#include <hipmob/hipmob.h>
-
Initialize the hipmob view controller with your HIPMOB_KEY from above.
hipmob *supportvc = [[[hipmob alloc] initWithAppID:HIPMOB_KEY] autorelease];
You can also initialize with a custom title as well.hipmob *supportvc = [[[hipmob alloc] initWithAppID:HIPMOB_KEY andTitle:SUPPORTTITLE] autorelease];
Finally, you can pass in anNSDictionarywith additional user interface settings.NSMutableDictionary * settings = [NSMutableDicationary dictionaryWithCapacity:5]; [settings setObject:[NSString stringWithFormat:@"How can we help?"] forKey:HIPMOB_SETTING_TEXT_ENTRY_PLACEHOLDER]; hipmob *supportvc = [[[hipmob alloc] initWithAppID:HIPMOB_KEY andTitle:SUPPORTTITLE andSettings:settings] autorelease];
-
Present the hipmob view controller modally.
[self presentModalViewController:supportvc animated:YES];
Some examples: WanderPlayer for iPhone and Killa Killa Whale for iPhone - And we're complete. Build your app. Note If you see build errors complaining about CFHTTP or Security then you missed step #2 above: just add in the dependencies in the Link Binary with Libraries section of your project's Build Phases.
- To log into Adium.
- To log into iChat.
- To log into Instantbird.
- To log into imo.
- To log into Pidgin.
- [PENDING] To log into Empathy.
- [PENDING] To log into Xabber.
- [PENDING] To log into Monal.
- If your XMPP client is not listed above, you can login using the username and password with a domain set to hipmob.com.
15-minute integration on iPad
- Perform steps #1 through #5 above.
-
Initialize the hipmob subview with your HIPMOB_KEY from above. Please note, it is VERY IMPORTANT: do not, under any circumstances, autorelease or release this object!. Because of the way that subviews work, we will handle this. The hipmob subview will be properly released whenever its parent view is dismissed.
hipmobView * ipadchat = [[hipmobView alloc] initWithAppID:HIPMOB_KEY];
As before, you can also initialize with a custom title as well.hipmobView * ipadchat = [[hipmobView alloc] initWithAppID:@HIPMOB_KEY andTitle:@"Support Chat"];
-
Show the hipmob subview whenever you are ready.
ipadchat.view.frame = CGRectMake(self.view.frame.size.height - 345, 50, 320, 240); [self.view addSubview:ipadchat.view];
Remember to keep track of the hipmobView and release it when it is no longer in use. You can check if the view is being displayed by checking the readonly displayed property of the object. To help with this you can use the willDismissHipmobView delegate method. - And we're complete. Build your app. Note As before, if you see build errors complaining about CFHTTP or Security then you didn't add the appropriate libraries: just add in the dependencies in the Link Binary with Libraries section of your project's Build Phases.
Requirements
- Familiarity with iOS development. The embedded framework comes with all the prebuilt includes so you only have to include the Framework Dependencies listed above as you would normally in Xcode.
- TouchJSON and SocketRocket: These are two libraries that we build into our embedded framework. They will collide with with local copies if you are are already using them. If you already use either library, you'll either need to remove them or to use the hipmob-bare embedded framework which will require that you include both of these.
- Hipmob is compatible with apps developed for iOS 4.3 or higher.
- As an administrator, you have to have an XMPP compatible client to connect to our servers (there are a ton of free ones: on Windows we recommend Pidgin, on OSX Adium, on Linux Empathy, on Android Xabber, and on iOS Monal or IMO. If you don't see your platform here we still love you: just reach out to us if you can't find one and we'll work with you to find one that works). Any other standards-compliant XMPP client should just work. We're also working on integration with federated XMPP servers (such as Google Talk and Facebook), and once that is ready you'll be able to use your existing messaging accounts.
Details
Framework Options
a. make sure you build both and use the bare Hipmob iOS library, OR
b. remove them both and use the full Hipmob iOS library: it includes the SocketRocket and TouchJSON libraries already. Drop it in and you're ready to go.
iPhone
hipmob *supportvc = [[[hipmob alloc] initWithAppID:HIPMOB_KEY] autorelease]; [self presentModalViewController:supportvc animated:YES];You can also initialize with a custom title as well:
hipmob *supportvc = [[[hipmob alloc] initWithAppID:HIPMOB_KEY andTitle:SUPPORTTITLE] autorelease];
iPad Chat View
This allows you to draw a Hipmob view anywhere on your screen and also let you interact with background elements.hipmobView * supportvc = [[hipmobView alloc] initWithAppID:HIPMOB_KEY]; [supportvc setFrame:CGRectMake(150,50,320,245)]; [self.view addSubview:supportvc.view];Remember to keep track of the hipmobView and release it when it is no longer in use. You can check if the view is being displayed by checking the readonly displayed property of the object. To help with this you can use the willDismissHipmobView delegate method demonstrated below:
@interface customViewController : UIViewController<hipmobViewDelegate>Remember When specifying this in your header file you will have to include hipmob/hipmob.h in your header file.
supportvc.service.delegate=self; //specifies that you will be looking for delegate methods in your view controller
-(void)willDismissHipmobView:(hipmobView *)hipmobview{
[supportvc release];
supportvc=nil;
}
The last line (supportvc=nil) is not neccessary but it does make it simpler to test in case you use the same object and want to see if it has been released or not.Note HIPMOB_KEY Is found in your dashboard under apps.
Framework Settings
Peer-to-Peer only
iPad only
These can be set as follows:supportvc.username=USERNAME; supportvc.useremail=EMAIL; supportvc.localdeviceid=unique Device ID; supportvc.context=@"Any information useful for the operator. For Example the screen hipmob was launched from.";The statusmessages object is slightly different than the simple keys that are being set above. This is a dictionary that contains the string that will be displayed to the user when certain status messages are received from the server. This will change as we add new features and new status messages become available. The full list of status messages is available below under Status Messages.
[suportvc.statusmessages setValue:NEW MESSAGE forKey:@"connecting"]
Accessing settings from the iPad hipmobView Class
supportvc.service.sername=YOUR USERNAME; supportvc.service.useremail=@"YOUR EMAIL"; supportvc.service.localdeviceid=@"unique Device ID"; supportvc.orientation = landscapeonly;The setting display is read-only and allows you to check if the hipmobView is being displayed or not.
Framework Delegate
Framework Methods
To access these methods you need to call them on the appropriate object: when using the hipmobView (on iPad) use the service member.
[supportvc setAvailabilityStatus:NO];
Chat Sessions
Figure 1: Connecting to the Hipmob communication network
Figure 2: Admins are available
Figure 3: No admins are available
User Interaction
Figure 4: Messages on an iPhone
Figure 5: Conversation in the admin's XMPP client
User Information
Customization: Notices
Customization: View
Localization
Push Notifications
Configuration Options
Application ID
hipmob *supportvc = [[[hipmob alloc] initWithAppID:@"fefed30c17f0409f89d5a4953c0fce1f"] autorelease];or
hipmob *supportvc = [[[hipmob alloc] initWithAppID:@"fefed30c17f0409f89d5a4953c0fce1f" andTitle:@"Support Chat"] autorelease];
Device ID
supportvc.localdeviceid=@"my-magical-device-identifier";
Name
supportvc.username=@"my-magical-username";
supportvc.email=@"my-magical-email";
Location
Context
supportvc.context=@"my-magical-context";
Availability Status
[supportvc setAvailabilityStatus:FALSE];
Status Messages
- connecting
- connected
- disconnected
- operatoronline
- operatoroffline
[supportvc.statusmessages setValue:@"Sorry, no one is here right now. Please leave a message" forKey:@"operatoroffline"]
LocalWebView
supportvc.localWebView=TRUE;
PeerDeviceID
supportvc.peerdeviceid=YOUR_FRIEND_DEVICE_IDNote Because Hipmob does not parse the provided device identifier or look at it in any other way, the Hipmob communication network will accept the same device identifier for multiple devices. Note that future functionality may depend on uniqueness of the device identifier.
Displayed
if(supportvc.displayed){
[supportvc.view removeFromSuperView];
}else{
NSLog(@"No hipmob object being displayed");
}
willDismissHipmobView
-(void) willDismissHipmobView:(hipmobView *)hipmobView{
[supportvc release];
supportvc=nil;
NSLog(@"Hipmob is being dismissed. Freeing the memory object");
}
launchURL
-(BOOL)launchURL:(NSString *)urlstring{
UIViewController *webViewController = [[[UIViewController alloc] init] autorelease];
UIWebView *uiWebView = [[[UIWebView alloc] initWithFrame: CGRectMake(0,0,self.view.bounds.size.width,self.view.bounds.size.height)] autorelease];
[uiWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlstring]]];
[webViewController.view addSubview: uiWebView];
[self.navigationController pushViewController:webViewController animated:YES];
return NO;
}
receivedMessageFromID
-(BOOL)receivedMessageFromID:(NSString *)senderid{
NSLog(@"User with id %@ sent you a message", senderid);
return TRUE;
}
View Background Color
HIPMOB_SETTING_VIEW_BACKGROUND_COLORNSDictionary passed to the init method:
NSMutableDictionary * settings = [NSMutableDicationary dictionaryWithCapacity:5]; [settings setObject:[UIColor purpleColor] forKey:HIPMOB_SETTING_VIEW_BACKGROUND_COLOR]; hipmob *supportvc = [[[hipmob alloc] initWithAppID:HIPMOB_KEY andSettings:settings] autorelease];
Window Background Color
HIPMOB_SETTING_WINDOW_BACKGROUND_COLORNSDictionary passed to the init method:
NSMutableDictionary * settings = [NSMutableDicationary dictionaryWithCapacity:5]; [settings setObject:[UIColor purpleColor] forKey:HIPMOB_SETTING_WINDOW_BACKGROUND_COLOR]; hipmob *supportvc = [[[hipmob alloc] initWithAppID:HIPMOB_KEY andSettings:settings] autorelease];
Window Border Color
HIPMOB_SETTING_WINDOW_BORDERNSDictionary passed to the init method:
NSMutableDictionary * settings = [NSMutableDicationary dictionaryWithCapacity:5]; [settings setObject:[UIColor purpleColor] forKey:HIPMOB_SETTING_WINDOW_BORDER_COLOR]; hipmob *supportvc = [[[hipmob alloc] initWithAppID:HIPMOB_KEY andSettings:settings] autorelease];
Window Separator Color
HIPMOB_SETTING_WINDOW_SEPARATOR_COLORNSDictionary passed to the init method:
NSMutableDictionary * settings = [NSMutableDicationary dictionaryWithCapacity:5]; [settings setObject:[UIColor purpleColor] forKey:HIPMOB_SETTING_WINDOW_SEPARATOR_COLOR]; hipmob *supportvc = [[[hipmob alloc] initWithAppID:HIPMOB_KEY andSettings:settings] autorelease];
Window Border Width
HIPMOB_SETTING_WINDOW_BORDER_WIDTHNSDictionary passed to the init method:
NSMutableDictionary * settings = [NSMutableDicationary dictionaryWithCapacity:5]; [settings setObject:[NSNumber numberWithFloat:1.0f] forKey:HIPMOB_SETTING_WINDOW_BORDER_WIDTH]; hipmob *supportvc = [[[hipmob alloc] initWithAppID:HIPMOB_KEY andSettings:settings] autorelease];
Navigator Background Color
HIPMOB_SETTING_NAVITAGION_BACKGROUND_COLORNSDictionary passed to the init method:
NSMutableDictionary * settings = [NSMutableDicationary dictionaryWithCapacity:5]; [settings setObject:[UIColor purpleColor] forKey:HIPMOB_SETTING_NAVIGATION_BACKGROUND_COLOR]; hipmob *supportvc = [[[hipmob alloc] initWithAppID:HIPMOB_KEY andSettings:settings] autorelease];
Toolbar Tint Color
HIPMOB_SETTING_TOOLBAR_TINT_COLORNSDictionary passed to the init method:
NSMutableDictionary * settings = [NSMutableDicationary dictionaryWithCapacity:5]; [settings setObject:[UIColor purpleColor] forKey:HIPMOB_SETTING_TOOLBAR_TINT_COLOR]; hipmob *supportvc = [[[hipmob alloc] initWithAppID:HIPMOB_KEY andSettings:settings] autorelease];
Placeholder Text
HIPMOB_SETTING_TEXT_ENTRY_PLACEHOLDERNSDictionary passed to the init method:
NSMutableDictionary * settings = [NSMutableDicationary dictionaryWithCapacity:5]; [settings setObject:[UIColor purpleColor] forKey:HIPMOB_SETTING_TEXT_ENTRY_PLACEHOLDER]; hipmob *supportvc = [[[hipmob alloc] initWithAppID:HIPMOB_KEY andSettings:settings] autorelease];
PSD Files for in-app chat
iPhone 5 Design Assets iPhone 4 & 4S Design Assets