Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

Fortumo

Anastasiia Karimova edited this page Mar 10, 2015 · 4 revisions

The current version doesn't support Fortumo subscriptions.

Before starting to work with OpenIAB library

Create a Fortumo account and add a required number of NOOK and Android services. One service corresponds to one price, e.g. for 3 in-apps with different prices you should create 3 different services.

In the Code

  1. Make sure that FortumoInApp-android-9.1.2-o.jar is attached to the project.

  2. In the AndroidManifest.xml add the following permissions

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <uses-permission android:name="android.permission.SEND_SMS" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

    and declare the Fortumo SDK objects

    <!-- Declare these objects, this is part of Fortumo SDK,
        and should not be called directly -->
     <receiver android:name="mp.MpSMSReceiver">
           <intent-filter>
               <action android:name="android.provider.Telephony.SMS_RECEIVED"/>
           </intent-filter>
       </receiver>
       <service android:name="mp.MpService"/>
       <service android:name="mp.StatusUpdateService"/>
       <activity android:name="mp.MpActivity"
                 android:theme="@android:style/Theme.Translucent.NoTitleBar"
                 android:configChanges="orientation|keyboardHidden|screenSize"/>
      ```
    if you want to support devices without sms functionality, add
    
     ```xml
     <uses-feature android:name="android.hardware.telephony" android:required="false"/>
  3. In the code setup an Options object

    OpenIabHelper.Options.Builder builder = new OpenIabHelper.Options.Builder();
    //set supportFortumo flag to true
    builder.setSupportFortumo(true);
    //or
    //by the way, you can add other stores object to the list
    builder.addAvailableStore(new FortumoStore(this));
    mHelper = new OpenIabHelper(this, builder.build());
  4. Add inapps_products.xml (in-app products descriptions in terms similar to Google Play) and fortumo_inapps_details.xml (data about your Fortumo services, need to be copy-pasted from Dashboard.) files to the assets folder. You can find a sample here. Example of inapp-products.xml

    <inapp-products>
        <!--Zero or more repetitions:-->
        <items>
            <!--Zero or more repetitions:-->
            <item id="sku_gas"
                  publish-state="published"> <!-- id: the same format as Google SKU, required; published: "published" or "unpublushed", required by the xsd, but is not actually used it the current implementation-->
                <summary><!--encapsulates all elements related to description, required-->
                    <summary-base><!--default strings elements, required-->
                        <title>1/4 of gas tank</title> <!-- default title, required-->
                        <description>Some gas to go further</description> <!-- default description, required-->
                    </summary-base>
                    <!--Zero or more repetitions:-->
                    <summary-localization locale="ru_RU"> <!-- locale: [a-z]_[A-Z], required-->
                        <title>Четверть бака бензина</title> <!-- required -->
                        <description>Немного топлива, чтобы проехать еще</description> <!-- required -->
                    </summary-localization>
                    <summary-localization locale="en_US">
                        <title>1/4 of gas tank</title>
                        <description>Some gas to go further</description>
                    </summary-localization>
                </summary>
                <price autofill="true"> <!-- autofill: true or false, required by the xsd, but is not used in the current implementation-->
                    <price-base>1.00</price-base> <!-- default price, required-->
                    <!--Zero or more repetitions:-->
                    <price-local country="RU"> <!-- country: [A-Z][A_Z], required-->
                        30.00</price-local>
                    <price-local country="EN">1.00</price-local>
                </price>
            </item>
           ...
        </items>
    </inapp-products>

    Example of fortumo_inapps_details.xml.

    <fortumo-products>
        <!--
        <product                    // mapping for particular fortumo service
            id="sku_gas"            // SKU with rules same to app store SKU
            service-id="61730610ade8f2f754bb3bd4b0c1fd0e"           // Fortumo serviceId need to be copy-pasted from Dashboard
            service-inapp-secret="cbc0da3763e59eee2d5a523fe5761346" // Fortumo inapp-secret need to be copy-pasted from Dashboard
            nook-service-id="61730610ade8f2f754bb3bd4b0c1fd0e"           // Fortumo NOOK serviceId need to be copy-pasted from Dashboard
            nook-service-inapp-secret="cbc0da3763e59eee2d5a523fe5761346" // Fortumo NOOK inapp-secret need to be copy-pasted from Dashboard
            consumable="true"/>     // consumable or not - currently is necessary parameter as wellas for Amazon
        -->
        <product
                id="sku_gas"
                service-id="61730610ade8f2f754bb3bd4b0c1fd0e"
                service-inapp-secret="cbc0da3763e59eee2d5a523fe5761346"
                nook-service-id="f2ca9394861085d34158e09cedd87738"
                nook-service-inapp-secret="78629d599dac532856cc2e90dd69e772"
                consumable="true"/>
        <product
                id="sku_premium"
                service-id="61730610ade8f2f754bb3bd4b0c1fd0e"
                service-inapp-secret="cbc0da3763e59eee2d5a523fe5761346"
                nook-service-id="f2ca9394861085d34158e09cedd87738"
                nook-service-inapp-secret="78629d599dac532856cc2e90dd69e772"
                consumable="false"/>
    </fortumo-products>

    Both files can be created using AppDF Editor.

  5. In the proguard config file add

     # FORTUMO
     -keep class mp.** { *; }
    

Test

tbd