NAV

Getting Started

MegoPro is one of the module of MegoPurchase. So here I am explaining what MegoPro is and how it works for an IOS App Developer.

Now a days , Mobile Technology is becoming too vast for the ease of the world, keeping the KISS principle (Keep It Short and Simple), Developers are doing their best to make the world Techno Freak. As their time is too precious, Frameworks are being developed to save their time. So while developing application they have certian featuers in thier application for which they want some limited access and I am sure for such kind of functionality they have to design a seprate module along with the main application.

Now I am sure, everybody have some questions in their mind, So lets start knowing What, Why and How? about MegoPro.

MegoProDemo is an app which shows how we have used our MegoPro module that helps developer to just concentrate on their main application development and makes them free from making such module which will provide some limited access to the topmost features of their application. By limited access we means you (developer) can provide some trial days, limited click access of a feature, limited item access from group of like items etc.

This tutorial is divided into several parts, each focusing on a different aspect of our MegoPro module used in this MegoProDemo application. Feel free to read them in any order, but we recommend that you download the source code and refer to it while reading. Some parts of the code were omitted or changed in this tutorial in order to keep it clear and concise, so you may find it useful to keep the full version close at hand.

Overview

As a mobile application developer we all know that while developing app their are certain features for which we want to give only limited access to the user. For example if we use any gaming application it has certain levels to play. If its a good game then after playing certain levels it stops us and ask if you want to play further then must unlock it to a Pro version. Have you ever thought how they do apply such restriction to their application.

I know you must be thinking you can make your own such module by your own. But think how much time you have to spend for such module as you have to maintain all the track of your app user, thier application usage details, how much trial days they have consumed, how many times they have used a certain features etc. Don’t you think its an headache and time cousuming way to maintain such things along with maintining your own app data.

Keeping all this in mind we have introduce our MegoPro module which helps and rescue developer to save thier time for developing such functionality and let them concentrate on thier app development only.

This moudle has six types of feature validation which have been integared in this demo application. This Demo app will show you how such validation works. All the validation types are desribed below:

Before explaining the details of above mentioned validation types we have to do some configuration settings in applicaitons AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method.The below two code snippets shows how we have configure our Demo app. First code snippet is used to Authenticate user application which is mendatory to call first.

MegoGridServerManager* megoGridServerManager=[[MegoGridServerManager alloc]init];
[megoGridServerManager initialize];

MegoAuthenticate class send notification to MegoGridServerManager that Authentication successful or not. thats why we call first MegoGridServerManager for define Notification Observer.

MegoAuthenticate* megoAuthenticate=[[MegoAuthenticate alloc] init];
megoAuthenticate initializeMego];

After making these to configuration you are ready to call our MegoPro module API in your app at any part of code that you want to be executed once this validation is success otherwise user will get the specific prompt of validation types and ask them to unlock it either with ads enable or with any custom purchase module you have integrated with your app. (We will explain later on how you can integrate your custom made purchase module with this module). Meanwhile just find the detailed description of above mentioned validation types.

Trial Days

In your application you have developed a feature which you want user can access it for limited number of days. This the validation which perform such functionality in your application. You just have to import the #import<MegoPurchase/MegoGridInAppModel.h> ’s getFeatureIdStatus() method at the point of your code which allow the access of that feature. This method takes two parameters which are as follows:

Please note you have to inherit the MegoGridInAppModelDelegate in particular class, where you want such validations in your application. Below is the code snippet that shows how I integrated such validation in this demo application:

-(void)megoInAppPro:(NSString*)boxId{
megoGridInAppModel=[[MegoGridInAppModel alloc]initWithNibName:nil bundle:nil];
megoGridInAppModel.customNavigationController=self.navigationController;
megoGridInAppModel.delegate=self;
[megoGridInAppModel getFeatureIdStatus:boxId item:0];
}
-(void)cameraViewClick
{
fromWhere=[@“camera” mutableCopy];
boxid=@“DYZRY1J6W”;
[self megoInAppPro:boxid];
[[NSUserDefaults standardUserDefaults]setValue:@“gallery” forKey:@“ImageType”];
[[NSUserDefaults standardUserDefaults]synchronize];
}
-(void)galleryImageViewClick
{
fromWhere=[@“gallery” mutableCopy];
boxid=@“DYZRY1J6W”;
[self megoInAppPro:boxid];
[[NSUserDefaults standardUserDefaults]setValue:@“gallery” forKey:@“ImageType”];
[[NSUserDefaults standardUserDefaults]synchronize];
}

It is delegate method where you get callback if feature is accessable or in under trail period.

you need to maintain record ,when isAccessGiven delegate give call back to Developer, that particular feature name or type as you can differentiate

as we shown in below code.

-(void)isAccessGiven:(MegoGridInAppModel *)megoGridInAppModel didFinishWithStuff:(NSString *)status
{
if ([fromWhere isEqualToString:@“camera”]) {
[self CameraCalling];
}
else
[self GalleryCalling];
}

Count

Suppose you have a feature in your application which should be accessed for limited number of clicks and if user exceeds the clicks he should be prompted with a dialog or message that you have exceeded the limit allowd then this is the validation that you can use in your app code for such features.Call the same mehtod which is explained in the Trial Days validation type and write your business code inside the body of the isAccessGiven delegate method.

Trail+Count

This validation type is the combination of above two types described just. As far implmentation concern just call the same method what you have done for the above two validation types and write the executable code inside the body of the isAccessGiven delegate() method. Although there is no difference between this validation type and above two but still it has one unique functionality and that functionality is if user exceeds the clicks/counts allowed by you they will start getting prompt irrespetive of the trial days left.

So such validation helps you to stop the usage of your feature as soon as possible and don’t want to wait till the trial days expired. For the code sample you can refer the same code which I have provided for Trial Days validation.

Max Concurrent-Recurring

If in your application there is a feature which contains the group of items which belong to same category like Gallery images, videos or any custom made collections of same kind of items and if you want a user can select only limited number of items at a time before performing the action then you can use this validation in you application code.

In this validation after each action performed user will be left only with items accessed minus total items access allowed if he comes next time to access these items.For example if items access allowed is 5 and at first time user has selected 2 items and performed the action then when he comes next time he will only left with 3 more items access.

For this validation you have to call three more API’s before calling the getFeatureIdStatus() which are as follows:

You can call deleteBoxCounter(String boxId) method inside the viewDidUnload method of the class so that it will remove the previously initialized boxId.

After configuring all the above three methods (which is present in MegoInappModel) provided in bullets call the getFeatureIdStatus method as usual you called for the other types of validation described above at the point of action which will be executed when user click the UI to perfrom his action on the selected items. Below is the code snippet which show how we have integared such validation in this Demo application:

After selecting the items user will perfrom his action. Once user clicked the following code fragment will execute which we have shown in the below code snippet:

Max Concurrent-Nonrecurring

This validation type is same as the previous Max Concurrent-Recurring but with subtle differece. Here the number items access count will remain same each time user access the items and perfrom his action rest all the implmentation will remain same. For the implementation details you can refer the same configuration steps and code sample.

Max Individual

If your application contains a feature which has group of items in sequential order like in a listview and you want users can access some of them in sequence then this validation type can be used for such purpose. What you have to do is call the getFeatureIdStatus() method and pass the item position as the second arguments of this methods.

Moreover, its not limited to listview only you can also use this validation in your custom made collection of items for which you want the limited access in a specific sequence. Below is the code snippet we used in this demo application that shows how this validation works.

Pleaes note that in this demo application we have used a custom collection of items and not a listview. So instead of passing the item position we have passed the static position as the second argument of getFeatureIdStatus() method.

Purchase

Purchase means unlocking the trial features to get its Pro version. To integarte your purchase module with our MegoPro module you just have to provide a deepLinkUrl to us which you can configure on CMS Panel by selecting own shop options. Do not get panic to think what deepLinkUrl is!. Its just an intent that will redirect the user to your own purchase module activity, where you have specify your own credit system and purchase mechanism.

Moreover you can also use our another modules i.e. MegoCoin or MegoShop or both together which hanldes the purchase mechanism for you. These modules have in-built credit system that can be integrated along with your MegoPro module. (To know more about these modules please refer their corresponding docs).





© 2015-2016 Megogrid Inc. / Term of service / Licenses / Privacy Policy 913 N Market Street Suite 200 Wilmington DE 19801 USA