简体   繁体   中英

Integrating Count.ly To Android Application

I want to use Count.ly with my Android app. I'm newbie on Android. There is an installation documentation here but i couldn't follow these steps.

1) I've added this to my manifest file, inside <application>

<service android:name="org.openudid.OpenUDID_service">
    <intent-filter>
        <action android:name="org.openudid.GETUDID" />
    </intent-filter>
</service>

2) Added this to my MainActivity's onCreate() method.

OpenUDID_manager.sync(getApplicationContext());

        if(OpenUDID_manager.isInitialized())
        {
            String oudid = OpenUDID_manager.getOpenUDID();

        }

But i'm stuck at next step . What they mean with

Add Countly.java to your project under Eclipse.

? Just i should copy Countly.java to my /src/com/blabla/appname folder?

Also i don't know what should i do after this step.

Solved. It was my mistake. I don't need to init OpenUDID on my project.

I just add these to my activity

@Override
    public void onStart()
    {
        super.onStart();
        Countly.sharedInstance().onStart();
    }

    @Override
    public void onStop()
    {
        Countly.sharedInstance().onStop();
        super.onStop();
    }

and this to onCreate()

Countly.sharedInstance().init(getApplicationContext(), "https://cloud.count.ly", "...");

And lastly copied src/org/* directory to my src dir , Countly.java file to my package.

Going by the guide. It looks like they do indeed want it copied to your project so that you can call its methods. All you need to do is plant it in the project.

Call its methods by using Countly. to call the class file.

Also don't forget to set up INTERNET permissions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM