0
package com.example.demoservice.extensions;

import android.content.ComponentName;
import android.util.Log;
import com.adobe.fre.FREContext;
import com.adobe.fre.FREFunction;
import com.adobe.fre.FREObject;

public class IapTstoreStartServiceFunction implements FREFunction {

    private static String TAG = IapTstoreStartServiceFunction.class.getSimpleName();

    public FREObject call( FREContext context, FREObject[] args ) {

        Log.d( TAG, "0 : " );

        try {
            Intent intent = new Intent( "com.example.demoservice.DemoService" );

            ComponentName cn = context.getActivity().startService( intent );

            Log.d( TAG, "1 : " + cn );  // <---- cn is null ******
        }
        catch( Exception e )
        {
            Log.d( TAG, "2 : " + e );
        }

        Log.d( TAG, "3 : " + cn );
        return null;
    }
}

When above function is called, startService() returns null ( cn is null) and onStartCommand of DemoService is not called. But DemoService starts correctly when it is called by native android activity. i can't start DemoService at the ANE AIR. Anybody can help me how can i solve this?

jin
  • 1
  • 1

1 Answers1

1

You should add your service to android part of AIR application descriptor:

<application android:enabled="true">
    <service android:name="com.example.demoservice.DemoService"/>    
</application>
Timothy Kovalev
  • 315
  • 1
  • 7