Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Opening app within an app.

Options

Comments

  • Registered Users Posts: 18,272 ✭✭✭✭Atomic Pineapple


    Hi, I am trying to use this app within an app at the moment. https://github.com/jackpal/Android-Terminal-Emulator/wiki/Launching-Android-Terminal-Emulator-from-another-App

    How do I do this in such a way as that app is part of my app install and they don't need to install it separately? Or what is best practice for that?

    You can't install it along with your own application (Unless you include the entire source code of the app with your app which you might not be allowed to do depending on it's licence), the best you can do is see if the application exists on the phone by checking to see if there's an app interested in that intent and if not alert the user that they must download it. You can then point them directly to the app on the Play store.

    One way of doing this is as follows:
    try{
        Intent i = new Intent("jackpal.androidterm.OPEN_NEW_WINDOW");
        i.addCategory(Intent.CATEGORY_DEFAULT);
        startActivity(i);
    }
    catch (ActivityNotFoundException e) {
        //No Activity to handle this request found so application not installed alert user to download this app
    }
    

    But there may be other more elegant ways of doing the check.


  • Moderators, Science, Health & Environment Moderators, Social & Fun Moderators, Society & Culture Moderators Posts: 60,092 Mod ✭✭✭✭Tar.Aldarion


    Thanks I'll do that check if I have to then. I thought maybe I could include the source so seeing as it is open source and has a section on tips for including ina custom rom etc?


  • Registered Users Posts: 18,272 ✭✭✭✭Atomic Pineapple


    Thanks I'll do that check if I have to then. I thought maybe I could include the source so seeing as it is open source and has a section on tips for including ina custom rom etc?

    Yeh that might be possible but check the licensing on the open source code first, it may have restrictions on what you can build/publish with the source code, you'll likely have to also make your code open source and possibly not be able to turn a profit from your app if your using open source code in it. It all depends on the licence though, best to give it a good read to see what's allowed.


  • Moderators, Science, Health & Environment Moderators, Social & Fun Moderators, Society & Culture Moderators Posts: 60,092 Mod ✭✭✭✭Tar.Aldarion


    All right I'll have a look for that license cheers.


  • Moderators, Science, Health & Environment Moderators, Social & Fun Moderators, Society & Culture Moderators Posts: 60,092 Mod ✭✭✭✭Tar.Aldarion


    As far as I can see I can use it, and other apps have used it, so now I just have to try and use their code I guess!


  • Advertisement
  • Registered Users Posts: 18,272 ✭✭✭✭Atomic Pineapple


    As far as I can see I can use it, and other apps have used it, so now I just have to try and use their code I guess!

    Not so bad, in that case it may be possible to take down the source code and create an Android library out of it and then add this library to your application, then all you have to do is use the API calls for what you want to do in your own app.


  • Moderators, Science, Health & Environment Moderators, Social & Fun Moderators, Society & Culture Moderators Posts: 60,092 Mod ✭✭✭✭Tar.Aldarion


    That sounds perfect. I'll have to look how to change the source code into a library and test using it. I've not much experience. I saw some option when creating a project to 'create as library' or something? Anyway I'll have a look

    Also I have java files etc, an android project without a .project file on my new computer, is there an actual easy way to add folders/source as a new project to eclipse?


  • Moderators, Science, Health & Environment Moderators, Social & Fun Moderators, Society & Culture Moderators Posts: 60,092 Mod ✭✭✭✭Tar.Aldarion


    Actually any good resources to learn about doing this, just the developer site perhaps?


  • Registered Users Posts: 18,272 ✭✭✭✭Atomic Pineapple




  • Moderators, Science, Health & Environment Moderators, Social & Fun Moderators, Society & Culture Moderators Posts: 60,092 Mod ✭✭✭✭Tar.Aldarion


    Thanks, much appreciated!


  • Advertisement
  • Moderators, Science, Health & Environment Moderators, Social & Fun Moderators, Society & Culture Moderators Posts: 60,092 Mod ✭✭✭✭Tar.Aldarion


    Can anybody get this app working? I downloaded a zip of the source here https://github.com/jackpal/Android-Terminal-Emulator/

    I added it to eclipse. If I go to run it on device/emulator I can type for a second and then it says it does not work and closes. The it will not even open any more, just closes?
    It has a lot of examples and stuff so I'm not sure about making it into a library, it's definitely not working after 2 hours trying anyway heh. As far as I can see, if I take this project code and click 'is library' and then use the library from another project that's it? I can call things from that project etc?


  • Registered Users Posts: 13,080 ✭✭✭✭Maximus Alexander


    It works for me as long as I don't click "Open Shell" which causes a force close.

    You don't need to download a zip, get the git plugin for eclipse and you can import it directly from github.


  • Moderators, Science, Health & Environment Moderators, Social & Fun Moderators, Society & Culture Moderators Posts: 60,092 Mod ✭✭✭✭Tar.Aldarion


    Thanks I'll try that method, didn't know about that plugin. Then I'll try to see about this library jazz.


  • Moderators, Science, Health & Environment Moderators, Social & Fun Moderators, Society & Culture Moderators Posts: 60,092 Mod ✭✭✭✭Tar.Aldarion


    Can't seem to get it to work at all when I run in an emulator or on a tablet. It jsut crashes after a sec and the log looks like this, did you not get that? You can actually run commands in the terminal etc?

    DD0s4.png


  • Registered Users Posts: 18,272 ✭✭✭✭Atomic Pineapple


    Your missing a native library, is the jackpal_androidterm4.so part of the GIT download? It should be in the libs folder. If not you will have to compile the native code from the JNI folder using the Android NDK.


  • Registered Users Posts: 7,157 ✭✭✭srsly78


    Having a native component makes life a lot more complicated. Surely you can get java code to do a terminal? Looks like the original author just compiled some opensource c++ to make that.

    Is easy to include native components with a custom rom, but is not so easy with an app because you don't know what architecture the customer will be running.


  • Moderators, Science, Health & Environment Moderators, Social & Fun Moderators, Society & Culture Moderators Posts: 60,092 Mod ✭✭✭✭Tar.Aldarion


    srsly78 wrote: »
    Having a native component makes life a lot more complicated. Surely you can get java code to do a terminal? Looks like the original author just compiled some opensource c++ to make that.

    Is easy to include native components with a custom rom, but is not so easy with an app because you don't know what architecture the customer will be running.
    I suppose I could try and do it in java, I was just told to incorporate this app though, good learning exercise for me. I've made a couple of simple apps but that's it, quite basic. Another thing is I have spent a lot of time today trying to understand all this and how I would make this code into a library I could use etc, which is quite interesting and I'd like to see it through and learn something useful. I'm not sure I even need to have this code running at all to be making it into a library I can use?

    As for the hardware, it is for a specific tablet that would be provided to people, so I do know what the app would be running on, so maybe it is easier. I can make sure the resources needed are on it.
    draffodx wrote: »
    Your missing a native library, is the jackpal_androidterm4.so part of the GIT download? It should be in the libs folder. If not you will have to compile the native code from the JNI folder using the Android NDK.
    I don't know if it is part of it as I have left that computer now, I know it is part of the apk somwhere. I think I may have done this wrong because I dont get all those library etc folders when I added it to eclipse. Actually I just saw the build file now which I didnt see before: https://github.com/jackpal/Android-Terminal-Emulator/blob/master/docs/Building.txt
    Build the project from the command line using "ant":

    You need to build the project from the commmand line in order to generate the
    shared libraries and Java JAR files used by Android Terminal Emulator.

    I had assumed I would just import it and it would work without such instructions. Would this be it?


  • Registered Users Posts: 7,157 ✭✭✭srsly78


    Those instructions seem geared towards rom makers not app makers. There are additional complications to consider when deploying the app into the wild.


  • Moderators, Science, Health & Environment Moderators, Social & Fun Moderators, Society & Culture Moderators Posts: 60,092 Mod ✭✭✭✭Tar.Aldarion


    Hmm, ok I'm gonna have to read more about this and do some work over the weekend to understand it better.


  • Moderators, Science, Health & Environment Moderators, Social & Fun Moderators, Society & Culture Moderators Posts: 60,092 Mod ✭✭✭✭Tar.Aldarion


    draffodx wrote: »
    Your missing a native library, is the jackpal_androidterm4.so part of the GIT download? It should be in the libs folder. If not you will have to compile the native code from the JNI folder using the Android NDK.

    Tanks my problem was with the NDK, I can run the project fine now.
    I was looking at making a library but I think they have made one already 'emulatorView'.

    Just have to see if that is actually what I think it is and will work, and if so how to use it etc.


  • Advertisement
Advertisement