Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Moved Java code additions to CodeBlocks

Introduction

...

Info
titleUsing Google Play Services

If you choose to use Google Play Services, you need to know the following :

  1. To test your app when using the Google Play services SDK, you must use either:

    • A compatible Android device that runs Android 2.3 or higher and includes Google Play Store.
    • The Android emulator with an AVD that runs the Google APIs platform based on Android 4.2.2 or higher.
  2. To make the Google Play services APIs available to your app:

    1. Copy the library project at <android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/ to the location where you maintain your Android app projects.
    2. Import the library project into your Eclipse workspace (if you use Eclipse) : Click File > Import, select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it.
    3. In your app project, reference Google Play services library project.

      Note: You should be referencing a copy of the library that you copied to your development workspace—you should not reference the library directly from the Android SDK directory.

  3. To prevent ProGuard from stripping away required classes, add the following lines in the<project_directory>/proguard-project.txt file:

     

    Code Block
    languagetext
    titleProGuard
    -keep class * extends java.util.ListResourceBundle {
        protected Object[][] getContents();
    }
    
    -keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
        public static final *** NULL;
    }
    
    -keepnames @com.google.android.gms.common.annotation.KeepName class *
    -keepclassmembernames class * {
        @com.google.android.gms.common.annotation.KeepName *;
    }
    
    -keepnames class * implements android.os.Parcelable {
        public static final ** CREATOR;
    }



 

...

Note

Eclipse Users : When compiling a production APK file with ProGuard and Appoxee , enter the following lines into the file "proguard-project.txt"

Code Block
languagetext
titleProGuard in Eclipse
linenumberstrue
-dontwarn

# OrmLite uses reflection

-keep class com.j256.**

-keepclassmembers class com.j256.** { *; }

-keep enum com.j256.**

-keepclassmembers enum com.j256.** { *; }

-keep interface com.j256.**

-keepclassmembers interface com.j256.** { *; }

-keepattributes Signature

-keepattributes *Annotation*

-keepclassmembers class * { public <init>(android.content.Context); }

 

In order to avoid these additions in each activity, you can simply extend AppoxeeBaseActivity instead of Activity. (AppoxeeBaseActivity extends Android’s FragmentActivity and contains the onStart() & onStop() calls)


...

  1. Your MainActivity needs to exted AppoxeeBaseActivity and implement AppoxeeObserver
  2. Your MainActivity onCreate() method should contain this code

     

    new
    Code Block
    languagejava
    titleonCreate()
    linenumberstrue
    ...
    new initAsync(getApplicationContext(),"APP_KEY",
                         
    
                         "SECRET_KEY", "com.package.MainActivity" , true, this).execute();
    
    AppoxeeManager.setDebug(true);
    
    Appoxee.parseExtraFields(getIntent().getExtras());
    
    setContentView(R.layout.main);
    
    ...
    ..
    
    
    

     

     

  3. Make sure that the following methods are implemented and contain Appoxee's method calls :

    @Override

       protected void onResume()

          {

        super.onResume();

     // If Inbox implemented and you have a method for updating your inbox’s

     // Badge

          updateMsgBadge();

          }

     

    d. @Override

     public void onRegistrationCompleted() {

      // TODO Auto-generated method stub

        Utils.Debug("Can perform all API Calls");

        

     }

     

     @Override

     public void onMessagesUpdateCompleted() {

               // If Inbox implemented and you have a method for updating your inbox’s

     // Badge

     

          Utils.Debug("Can update Badge");

          updateMsgBadge();

     

     }
    Code Block
    languagejava
    linenumberstrue
        @Override
        protected void onResume()
        {
         super.onResume();
         // If Inbox implemented and you have a method for updating your inbox's 
         // Badge
         updateMsgBadge();
        }
    
    
     @Override
     public void onRegistrationCompleted() {
      // TODO Auto-generated method stub
         Utils.Debug("Can perform all API Calls");
     }
    
    
     @Override
     public void onMessagesUpdateCompleted() 
     {
     // If Inbox implemented and you have a method for updating your inbox's 
     // Badge
        Utils.Debug("Can update Badge");
        updateMsgBadge();
     }
    
    
    

     

     

    Note

    To fully use Appoxee’s Analytics , all of your activities should implement onStart() & onStop in the actvities code :

     
    Code Block
    languagejava
    linenumberstrue
    @Override
     
    protected void onStart()

                  {

      
    
    {
       super.onStart();
       
    
       Appoxee.onStart();

                 }

       

    @Override

                 protected void
    
    }
        
    @Override
    protected void onStop()

                 {

      
    
    {
       super.onStop();
      
    
       Appoxee.onStop();
    }
    
    
    

                 }

     

    In order to avoid these additions in each activity, you can simply extend AppoxeeBaseActivity instead of Activity. (AppoxeeBaseActivity extends Android’s FragmentActivity and contains the onStart() & onStop() calls)

    Option B: Implicit Integration (without using Observer)

    1. In your main activity class onCreate() method enter the following code :

      Code Block
      languagejava
      linenumberstrue
      ...
      new
      initAsync(getApplicationContext(),"APP_KEY",                     
       initAsync(getApplicationContext(),"APP_KEY",
                           "SECRET_KEY", true, "com.package.MainActivity").execute();
      
      AppoxeeManager.setDebug(true);
      
      Appoxee.parseExtraFields(getIntent().getExtras());
      
      setContentView(R.layout.main);
      
      ...
      ..
      
      
      

       

       

    2. Make sure that the following methods are implemented and contain Appoxee's method calls :

       

      @Override  protected void
      Code Block
      languagejava
      linenumberstrue
      @Override  
      protected void onStart() 

        {

         
      
      {
         super.onStart();
         
      
         Appoxee.onStart();
       

        }

       

       @Override

       

        protected void onStop()

       

        {

         
      
      }
      
      @Override
      protected void onStop()
      {
         super.onStop();
         
      
         Appoxee.onStop();
       

        }

        @Override       protected void
      
      }
      
      @Override       
      protected void onNewIntent(Intent intent)
       

           {

                 
       
      {
         super.onNewIntent(intent);
                 Bundle bundle =
      
         Bundle bundle = intent.getExtras();
                 
      
         Appoxee.parseExtraFields(bundle);

      }

      @Override 

      protected void
      
      }
      
      @Override 
      protected void onResume()
       

       {

        
      
      {
        super.onResume();
        
      
        // If Inbox implemented and you have a method for updating
      your inbox’s   
       your inbox's 
        //
      Badge   updateMsgBadge
       Badge
        updateMsgBadge();
      }
      
      

       

       }

       

      Note

      When Integrating Appoxee and choosing not to use an Observer, All Appoxee API Calls will fail unless implementing a thread that will sample the flag

      Appoxee.isReady()==true. Only then will the API Calls will execute (Tags,Alias... )


      Note

      To fully use Appoxee’s Analytics , all of your activities should implement onStart() & onStop in the actvities code :

      Code Block
      languagejava
      linenumberstrue
      @Override 
      protected void onStart()
        {
         super.onStart();
         Appoxee.onStart();
        }
          
      @Override
      protected void onStop()
        {
         super.onStop();
         Appoxee.onStop();
        }
      
      

      In order to avoid these additions in each activity, you can simply extend AppoxeeBaseActivity instead of Activity. (AppoxeeBaseActivity extends Android’s FragmentActivity and contains the onStart() & onStop() calls)

     

...