Good day, I have good and bad news.

Firts, Clement thanks, exactly it is need to add in the manifest file the
line:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

But, it is not enough if you are proving in a emulator. In this case, you
need emulate an sdcard because if you don't make this you will not have
permissions in the sdcard. So, if someday you have this problem, you must
write in console in sdk path/tools:

mksdcard 64M mySDCard (this creates the sdcard)
android create avd -n nombre -t 4 (this creates an emulator)
emulator -avd nombre -sdcard mySDCard (this launches the emulator with the
sdcard)

At this moment, you can create and push files in sdcard. Now, in my case is
important don't forget make the push collectionOfJarsFiles in this new
emulator with
adb push C:\EclipseDevelopment\ApacheFelix\Apache_felix_demo\bundle
/data/felix


Well, the bad news are that...now I can install a bundle but I think this is
wrong.

I put here the modified code provided by Bruce:

void launchFelix() 
    {   
        Log.d("Felix", "About to start Felix...");
        // Create a configuration property map  
        String cacheDir = null;
        try 
        {
                cacheDir = File.createTempFile("skifta", ".tmp").getParent();
                } 
        catch (IOException e) 
        {
                        Log.d("Felix", "unable to create temp file", e);
                        return;
                }
        
        Map configMap = new StringMap(false); 
        configMap.put("org.osgi.framework.storage", cacheDir);
        configMap.put("felix.embedded.execution", "true");
        configMap.put("org.osgi.service.http.port", "9990");
        configMap.put("org.osgi.framework.startlevel.beginning", "5");

        try
        {
            // Now create an instance of the framework with
            // our configuration properties.
            m_felix = new Felix(configMap);
            // Now start Felix instance.
            m_felix.start();
            Log.d("Felix", "Felix is started");
            
            BundleContext bc=m_felix.getBundleContext();
            bc.installBundle("file:/data/felix/EnglishDictionary.jar");         
 
            
            for(org.osgi.framework.Bundle b :
m_felix.getBundleContext().getBundles()) 
            {
                b.start();
                Log.d("Felix", "Bundle: " + b.getSymbolicName());       
            }
        } 
        catch (Throwable ex) 
        {
            Log.d("Felix","Could not create framework: " + ex.getMessage(),
ex);
        }
    }    


Well, the install is it made without problems, program don't jumps to the
catch. So, I make install of the EnglishDictionary.jar. But, then, when I
iterate in the for, the b.start() is also made, but I think that I am doing
something wrong because b.getSymbolicName() "null". 

So, what do you think?The bundle is installed?I installed a void bundle?I
made something wrong?

Salutations and thanks for everyone.
Pablo Muñoz.



clement escoffier wrote:
> 
> Hi,
> 
> 
> 
> On 16.02.2010, at 19:20, pablomj wrote:
> 
>> 
>> Hi everyone, I know what is my current problem.
>> 
>> the problem is in this try
>> 
>>    void launchFelix() 
>>    {
>>      Log.d("Felix", "About to start Felix...");
>>      // Create a configuration property map
>>      String cacheDir = null;
>>      //String FELIX_CACHE_DIR =
>> "/data/data/net.luminis.android.felix/cache";
>>      try {
>>                      cacheDir = File.createTempFile("skifta", 
>> ".tmp").getParent();
>>              } catch (IOException e) {
>>                      Log.d("Felix", "unable to create temp file", e);
>>                      return;
>>              }
>> .
>> .
>> .
>> 
>> Because I don't have permissions to write in the /sdcard directory of the
>> emulator. So, the program can't create the temp file.
>> 
>> somebody knows how I can add permissions to this directory?
>> Thanks.
> 
> Recent Android version have introduced a permission to write on the sdcard
> Add this line to your manifest:
> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
> />
> 
> Moreover, check that you have created an AVD with an SDCARD. 
> 
> Regards,
> 
> Clement
> 
>> 
>> 
>> 
>> 
>> 
>> clement escoffier wrote:
>>> 
>>> 
>>> On 15.02.2010, at 18:56, pablomj wrote:
>>> 
>>>> 
>>>> Hi everyone, here are my advances,
>>>> 
>>>> I reviewed all steps, I can instanciate a Felix object like in your
>>>> example.
>>>> It was a problem with dependencies. 
>>>> 
>>>> Proving for install for start and stop a bundle I made in the code:
>>>> 
>>>>           BundleContext newBundle = m_felix.getBundleContext();
>>>>           bb.installBundle(pathOfTheBundle);
>>>> 
>>>> When...now my problem is this pathOfTheBundle, I tried put in
>>>> pathOfTheBundle "/data/felix/EnglishDictionary.jar" (location where I
>>>> put
>>>> this bundle with adb push ..... in console )and some variants, but
>>>> always
>>>> is
>>>> an wrong path. What I must express my bundle location?
>>>> 
>>>> Can anybody help me? Thanks again. 
>>> 
>>> Try with: file:/data/felix//EnglishDictionary.jar. 
>>> 
>>> Be also aware that this location is not available on regular devices.
>>> For
>>> such kind of manipulation, you should use the external storage
>>> (generally
>>> /sdcard, but use the Environment class to get the root). (you can also
>>> use
>>> the internal application assets).
>>> 
>>> Regards,
>>> 
>>> Clement
>>> 
>>>> 
>>>> Regards, Pablo.
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Jackson, Bruce wrote:
>>>>> 
>>>>> Yes, you can.
>>>>> 
>>>>> In the code I sent you, you'll see that you can get a handle to the
>>>>> BundleContext for the framework itself. From this you can then call:
>>>>> 
>>>>> context.installBundle(String location);
>>>>> 
>>>>> to install your own bundles.
>>>>> 
>>>>> 
>>>>> On 12/02/2010 15:07, "pablomj" <[email protected]> wrote:
>>>>> 
>>>>>> 
>>>>>> Oh, thanks Bruce and Karl for your comments.
>>>>>> 
>>>>>> I did something wrong, because I can't instanciate an "Felix" object.
>>>>>> So,
>>>>>> I
>>>>>> am going to review all steps...
>>>>>> 
>>>>>> Although I don't see running this yet, I will can start and stop
>>>>>> bundles
>>>>>> from my Android application? I excited to view this!
>>>>>> 
>>>>>> Regards,
>>>>>> Pablo.
>>>>>> 
>>>>>> 
>>>>>> Karl Pauls wrote:
>>>>>>> 
>>>>>>> Why would you need 1.5 to be able to dex the bundle (the framework
>>>>>>> itself is build for 1.3 btw.)?
>>>>>>> 
>>>>>>> regards,
>>>>>>> 
>>>>>>> Karl
>>>>>>> 
>>>>>>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce
>>>>>>> <[email protected]>
>>>>>>> wrote:
>>>>>>>> Hi Pablo
>>>>>>>> 
>>>>>>>> See the attached code. The biggest problem I've encountered is that
>>>>>>>> the
>>>>>>>> Felix distribution is a huge pain to build under JDK 1.5, and
>>>>>>>> therefore
>>>>>>>> to
>>>>>>>> be able to use some of the bundles (for example the http service)
>>>>>>>> that
>>>>>>>> are
>>>>>>>> part of the distribution. Its not a simple job of just changing a
>>>>>>>> couple
>>>>>>>> of
>>>>>>>> entries in POM files: some components download pre-built JAR files
>>>>>>>> from
>>>>>>>> the
>>>>>>>> web and explode these, thereby having classes built under 1.4 which
>>>>>>>> will
>>>>>>>> not
>>>>>>>> work when you dexify the bundles.
>>>>>>>> 
>>>>>>>> This is something that would be great to see some work done on by
>>>>>>>> the
>>>>>>>> Felix
>>>>>>>> community, because while its true that the basic Felix core does
>>>>>>>> and
>>>>>>>> will
>>>>>>>> support Android, most of the add-on bundles wont.
>>>>>>>> 
>>>>>>>> For my part, the ideal solution would be to see the whole framework
>>>>>>>> be
>>>>>>>> based
>>>>>>>> on JDK 1.5 and not 1.4.
>>>>>>>> 
>>>>>>>> Thanks
>>>>>>>> 
>>>>>>>> Bruce
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On 12/02/2010 11:32, "pablomj" <[email protected]> wrote:
>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>>>>>>>> Do you have some advance?
>>>>>>>>> Salutations, thanks.
>>>>>>>>> Pablo.
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Jackson, Bruce wrote:
>>>>>>>>>> 
>>>>>>>>>> The Felix site has a useful section on getting things going on
>>>>>>>>>> Android
>>>>>>>>>> (
>>>>>>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html)
>>>>>>>>>> but
>>>>>>>>>> isn't
>>>>>>>>>> so clear about embedding the framework into an Android app"
>>>>>>>>>> 
>>>>>>>>>> "Apache Felix can also be integrated with an Android application.
>>>>>>>>>> To
>>>>>>>>>> achieve
>>>>>>>>>> this, you need to embed Felix into onCreate() method of your
>>>>>>>>>> Activity
>>>>>>>>>> class
>>>>>>>>>> (see Android docs for more details on how to use an Activity) and
>>>>>>>>>> process
>>>>>>>>>> your bundles as shown above."
>>>>>>>>>> 
>>>>>>>>>> Has anyone got an example of how you do this? I understand how to
>>>>>>>>>> write
>>>>>>>>>> the
>>>>>>>>>> Android app, and I get the point being made here. What I need to
>>>>>>>>>> understand
>>>>>>>>>> is:
>>>>>>>>>> 
>>>>>>>>>> 1. How do you launch the Felix framework. What do I need to
>>>>>>>>>> instantiate?
>>>>>>>>>> 2. Where does the framework get its boot configuration (i.e. what
>>>>>>>>>> bundles
>>>>>>>>>> to
>>>>>>>>>> load, run levels, environment variables, etc) from in this case?
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> -- 
>>>>>>> Karl Pauls
>>>>>>> [email protected]
>>>>>>> 
>>>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> -- 
>>>> View this message in context:
>>>> http://old.nabble.com/Felix-on-Android-tp27245141p27597525.html
>>>> Sent from the Apache Felix - Dev mailing list archive at Nabble.com.
>>>> 
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://old.nabble.com/Felix-on-Android-tp27245141p27612787.html
>> Sent from the Apache Felix - Dev mailing list archive at Nabble.com.
>> 
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Felix-on-Android-tp27245141p27625688.html
Sent from the Apache Felix - Dev mailing list archive at Nabble.com.

Reply via email to