erik
erik

Reputation: 4948

how to create an android native library/extension for phone gap

I have created a native android service, something like this:

public class AssociateNavService extends Service {

    /* (non-Javadoc)
     * @see android.app.Service#onBind(android.content.Intent)
     */

    @Override
    public void onCreate() {

       //some code
    }


    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {

        //some layout stuff

        statusChecker.run();

        // If we get killed, after returning from here, restart
        return START_REDELIVER_INTENT;
    }

    @Override
    public IBinder onBind(Intent intent) {

        // We don't provide binding, so return null
        return null;
    }

    @Override
    public void onDestroy() {

        unregisterReceiver(batteryReceiver);
        mHandler.removeCallbacks(statusChecker);
        winMgr.removeView(disableStatusBar);
        //Toast.makeText(this, "service done", Toast.LENGTH_SHORT).show(); 
    }


    ....
}

now a friend who is doing a project in phoneGap was wondering if he could use this said service in his project as a native library or extension.

Can someone point me to a tutorial as to how to do this..

Upvotes: 1

Views: 1637

Answers (1)

Nick Roth
Nick Roth

Reputation: 3077

To integrate any custom native functionality use the Plugin API.

http://docs.phonegap.com/en/2.3.0/guide_plugin-development_index.md.html

Upvotes: 1

Related Questions