Home > pinkelstar-android

pinkelstar-android

Pinkelstar-android is a project mainly written in Java, it's free.

The PinkelStar Android UI Library, an excellent start to integration

PinkelStar Android UI Framework

This is the home of the PinkelStar Android Client UI Framework. To use this framework you will need to register for a developer account at PinkelStar. Once registered, you can download the framework by cloning this repository :

git clone [email protected]:PinkelStar/pinkelstar-android-ui.git PinkelStarAndroidUI

This repository contains the entire UI project which you can use as-is or modify to fit the needs of your application. Also contained is a jar file in the lib directory which is used by the UI to communicate with the PinkelStar server. Full instructions are included below on how to add the UI code to an Android project.

If you want to play around with a demo app which has PinkelStar already setup in it, you can download the source here or clone this repository using:

git clone git://github.com/PinkelStar/pinkelstar-android-demo.git

(*remember to have a quick read of the readme)

If you wish to create a custom UI and use the server communication jar directly. Please see the documentation which is also available from the downloads section.

Please post feature requests and bug reports to the GitHub issues tab.

If you see a possible improvement or feature which can be added, please fork this project, make the required changes, and send us a pull request so we can merge your enhancements in to the master UI project.

Many thanks to jteam.nl for their tutorial on image caching.

Please post your questions to the support forum and we will answer ASAP.

Happy Coding,

The PinkelStar Team

Requirements:

  • Eclipse
  • ADT 0.9.7
  • Android 1.5 SDK

Steps for setting up your first PinkelStar enabled Android app :

  • Create a new Android Project (create default activity to reference and edit later)

  • Add a button inside the LinearLayout in res/layout/main.xml

    <Button android:text="Share" android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
  • Add the following code to the default activity class, after setContentView, to start PinkelStar:

    Button b = (Button) findViewById(R.id.Button01);
    b.setOnClickListener(new View.OnClickListener() {
      public void onClick(View v) {
        Intent intent = new Intent(ACTIVITYCLASSNAME.this, com.pinkelstar.android.ui.PSSharing.class);
        intent.putExtra("developerMessage", "this is a custom developer message");
        startActivity(intent);
      }
    });
    • replace ACTIVITYCLASSNAME with your default activity.
    • set an appropriate developer message in the intent by setting developerMessage.
    • set an appropriate content url in the intent by setting contentUrl. (optional)
  • Add the PinkelStar UI project as an Android library:

    • If not already done, import the UI project into your workspace. Make sure that the project name does not have dashes, underscores, periods or spaces.
    • Right click on your project and select Properties.
    • From the list on the left, select Android.
    • At the bottom press the add button and select the project you imported PinkelStar as from the dialog.

    Project Properties > Android > Add (in Library section) > PinkelStarAndroidUI (depending on the name of the PinkelStar UI project)

  • Add the PinkelStar Server jar to the build path of your project.

    • Right click on your project and select Properties.
    • From the list on the left, select Build Path.
    • On the Libraries tab, press the Add Jars.. button and select the jar in the lib directory of your PinkelStar project.

    Java Build Path > Libraries > Add Jars.. > PinkelStarAndroidUI/lib/pinkelstar-android-server.jar

  • In AndroidManifest.xml some changes are needed which:

    • reference the Application in the name parameter of the application tag.

      If your app (or another library your app uses) needs to implement its own application class, either make it a subclass of PSApplication or have it implement the same functionality as in PSApplication. Don't forget to reference your own application class in the application xml below.

      <application android:icon="@drawable/icon" android:name="com.pinkelstar.android.ui.PSApplication" android:label="@string/app_name">
    • add the pinkelstar activies inside the application tag

      <activity android:name="com.pinkelstar.android.ui.PSSharing" android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
      <activity android:name="com.pinkelstar.android.ui.PSSettings" android:screenOrientation="portrait" />
      <activity android:name="com.pinkelstar.android.server.NetworkAuth" android:theme="@android:style/Theme.Translucent" />
    • add the permissions for accessing the internet and the device id below the application tag

      <uses-permission android:name="android.permission.INTERNET" />
      <uses-permission android:name="android.permission.READ_PHONE_STATE" />
  • Create a file in /res/xml called pinkelstar.xml and paste in the follow code, but don't forget to add your app key and secret from the application details in the developer console

    <settings>
        <key>insert your app key here</key>
        <secret>insert your app secret here</secret>
        <preloadimages>true</preloadimages>
    </settings>
  • To enable logging, open a shell using the adb tool and set the logging level to VERBOSE like so setprop log.tag.PinkelStar VERBOSE.

    Log messages tagged with 'PinkelStar' will be shown in the logcat output.

    If you are using eclipse, you can also set -prop log.tag.PinkelStar=VERBOSE to the 'additional emulator command line options' field on the 'target' tab of the run configuration of your app.