Skip to content

Client Application Integration

Nathan Lapierre edited this page Aug 19, 2020 · 4 revisions

Client Application Integration (Mobile)

Mealime will provide an iOS, Android, or React Native SDK(s) that you will need to add to your project. The SDK allows you to present a customizable, branded meal planning UI within your app.

Installation

The SDK is custom-built to accommodate your data integration. We will provide you application-specific instructions, but in general it is installed by:

  • iOS: Adding the SDK as a pre-built XCframework to Xcode, or through your preferred package manager
  • Android: Adding the SDK to you project through Gradle
  • React Native: Adding the SDK as a dependency through NPM/Yarn

Initialization

Configure the SDK to match your application's branding:

  • Primary and secondary colors
  • Store Name & logo

Objective-C (Swift available)

@ import MealimeSDK

Java

import com.mealime.MealimeSDK

Objective-C (Swift available)
Place in the application didFinishLaunchingWithOptions method:

MealimeSDKConfig *config = [MealimeSDKConfig ...]; 
[MealimeSDK initializeWithConfig:config];

Java
Place in the onCreate() method of the Application or Activity class:

MealimeSDK.INSTANCE.init(...);

Presentation

Present the Meal Planning UI, passing in:

  • A Store Identifier, as described in the data integration docs
  • A unique user identifier. This allows the SDK to maintain a user's preferences, including favorite and custom recipes. This should not contain personally identifiable information, and does not need to be associated with your application's existing user identifiers.

Objective-C (Swift available)

MealimeSDKPlannerUiConfig *config = [MealimeSDKPlannerUiConfig ...]; 
UIViewController *mealPlanner = [MealimeSDKPlannerUi buildWithConfig:config];
[self.navigationController pushViewController:mealPlanner animated:YES];

Java

MealimeSDKPlannerActivity.Builder.(configuration).show(MyActivity.this);

Completion

Your application should handle completion of meal planning, through a delegate (iOS) or activity result (Android). Add the user's meal plan ingredients to their cart, if required.

Objective-C (Swift available)

@interface ViewController () <MealimeSDKPlannerDelegate>
@end
@implementation ViewController

...
- (void) didCancelMealPlanning
{
    NSLog(@"User cancelled meal planning without creating a meal plan");
}
- (void) didCreateMealPlan:(NSArray*) mealPlanItems
{
    // Meal plan items (UPCs and quantities)
}

Clone this wiki locally