Tuesday 12 November 2013

CodeRage 8 video replays are up

For anyone that’s been waiting for the replay videos from CodeRage to go up and has been getting impatient as the suggested 2 week window has come and gone, relief is now available as the replay videos are all there.

You can find them on YouTube on the Embarcadero TechNet page, or on the original CodeRage 8 session page.

Well, ok, maybe as I type one or two are still slowly dribbling onto the Internet and maybe the sessions page hasn’t quite got all the video links on board, but the majority are accessible in one way or another on YouTube at last.

I’ve updated my CodeRage 8 session files post to include the video links to my talks in case anyone wants to check them out. Enjoy!

24 comments:

  1. I just watched the Accessing the iOS API sessison replay and i am simply blown away. Esspecially the Barcode example caught my eye. For me a and maybe others would be of interest how to read QR-Code with Delphi XE5 in Android. Maybe you can give some direction how to achieve this goal.

    ReplyDelete
    Replies
    1. Hi, thanks for the feedback. I'm glad the sessions looked useful.
      The barcode sample was in the Android session and the sample code for the Android project that does the barcode stuff is in the other blog post linked at the end of this one.
      The Android barcode scanner app can read regular barcodes and QR codes, so the sample should work against it.
      Just be sure to read carefully through the Readme file that is with each of the sample projects I've uploaded.

      Delete
  2. Thank you too much Brian, really excellent session about android beyond the delphi limits.
    I have a question, how can i apply this to use Admob on my delphi?

    thanks in advance
    W.Sarab

    ReplyDelete
    Replies
    1. AdMob would require merging the AdMob jar file into classes.dex, writing import classes for the classes in AdMob and then making use of them, in the same way that FMX makes use of a number of Android SDK classes.
      I'm not aware of a public sample that does this yet.

      Delete
    2. Thanks Brian, I will try to do so.
      W.Sarab

      Delete
    3. Has anyone got to work with admob on delphi?

      RTR

      Delete
    4. There's been no public noise about this. Maybe people are doing actual regular development at the moment and will look at this in due course.
      All I can say is that in-app purchasing and in-app advertising were on the last roadmap I saw (http://edn.embarcadero.com/article/42544), so hopefully they will be productised very soon!

      Delete
    5. OK. Thanks Brian for info.

      RTR

      Delete
    6. Hello Brian.

      I was looking at SplashActivity.java and NativeActivitySubclass.java to try to include Admob Ads.

      It seems it wants to load, but my mobile screen doesn't show me ads.

      I tried this (I have included Admob SDK, SplashActivity.java and NativeNativitySubclass.java in classes.dex):

      imports .......

      public class NativeActivitySubclass extends com.embarcadero.firemonkey.FMXNativeActivity {

      private AdView adView;

      static final String TAG = "NativeActivitySubclass";

      int get_resource_id(String resourceName, String resourceType)
      {
      return this.getResources().getIdentifier(resourceName, null,
      this.getPackageName()) ;
      }

      @Override
      protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      //Custom initialization
      Log.d(TAG, "onCreate");

      this.adView = new AdView(this, AdSize.BANNER,"MyID");

      RelativeLayout layout = new RelativeLayout(this);
      layout.setLayoutParams(new RelativeLayout.LayoutParams(
      RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT));
      layout.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);

      layout.addView(adView);

      adView.loadAd(new AdRequest());
      adView.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
      adView.bringToFront();

      }

      }

      I know that the problem is the layout, but I don't know how to solve it.

      I was looking at FMXNativeActivity in classes.dex, and in the Oncreate event I saw this:

      ((ViewGroup)findViewById(16908290)).addView(this.mTextView);

      What is the ID layout of FMXNativeActivity? Is it16908290?

      I try this with my layout, and It doesn't work.

      I need your help, please.


      Best Regards

      RTR

      Delete
    7. I don't know the layout ID you ask after. However I'd recommend looking at how the web browser is displayed on a form, as that is a native control, much as your AdMod control is. You should be able to use the same approach as they do.

      Delete
    8. Thanks a lot Brian. I will try that.

      RTR

      Delete
    9. Looks like Delphi XE6 has a TBannerAd - http://docwiki.embarcadero.com/Libraries/XE6/en/FMX.Advertising.TBannerAd - component that wraps up AdMob on Android and iAd on iOS. See http://docwiki.embarcadero.com/RADStudio/XE6/en/Adding_Advertising_to_Your_Mobile_Apps for more information.

      Delete
  3. I test "splashscreen" my own applications (KAASU.EXE),
    but only coming text KAASU si stopped (sorry bad english).
    What i do bad?
    I copy you SpashScreen directory directores "java" and "res",
    run "build" files, and delete selected old classes file.
    I not understant english very good...

    ReplyDelete
    Replies
    1. I run BUILD-file and see this:


      setlocal

      if x == x set ANDROID=C:\Users\Public\Documents\RAD Studio\12.0\PlatformSDKs\adt-bundle-windows-x86-20130522\sdk

      set ANDROID_PLATFORM=C:\Users\Public\Documents\RAD Studio\12.0\PlatformSDKs\adt-bundle-windows-x86-20130522\sdk\platforms\android-17

      set DX_LIB=C:\Users\Public\Documents\RAD Studio\12.0\PlatformSDKs\adt-bundle-windows-x86-20130522\sdk\build-tools\android-4.2.2\lib

      set EMBO_DEX="C:\Program Files (x86)\Embarcadero\RAD Studio\12.0\lib\android\debug\classes.dex"

      set PROJ_DIR=C:\XE5project\Kaasupullot\Android\java

      set VERBOSE=0

      echo.


      echo Compiling the Java splash screen activity source file
      Compiling the Java splash screen activity source file

      echo.


      mkdir output\classes 2>nul

      if x0 == x1 SET VERBOSE_FLAG=-verbose

      javac -Xlint:deprecation -cp C:\Users\Public\Documents\RAD Studio\12.0\PlatformSDKs\adt-bundle-windows-x86-20130522\sdk\platforms\android-17\android.jar -d outp
      ut\classes src\com\blong\test\SplashActivity.java
      javac: invalid flag: Studio\12.0\PlatformSDKs\adt-bundle-windows-x86-20130522\sdk\platforms\android-17\android.jar
      Usage: javac
      use -help for a list of possible options

      C:\XE5project\Kaasupullot\Android\java>echo.


      echo Creating jar containing the new classes
      Creating jar containing the new classes

      echo.


      mkdir output\jar 2>nul

      if x0 == x1 SET VERBOSE_FLAG=v

      jar cf output\jar\test_classes.jar -C output\classes com
      output\classes\com : no such file or directory

      echo.


      echo Converting from jar to dex...
      Converting from jar to dex...

      echo.


      mkdir output\dex 2>nul

      if x0 == x1 SET VERBOSE_FLAG=--verbose

      call dx --dex --output=C:\XE5project\Kaasupullot\Android\java\output\dex\test_classes.dex --positions=lines C:\XE5project\Kaasupullot\Android\java\output\jar\te
      st_classes.jar
      no classfiles specified

      Merging dex files

      Error: Could not find or load main class Studio\12.0\PlatformSDKs\adt-bundle-windows-x86-20130522\sdk\build-tools\android-4.2.2\lib\dx.jar
      Tidying up


      Now we have the end result, which is output\dex\classes.dex

      Delete
    2. Looking at the first command that fails, it's the javac call, and that looks like it requires quotes around the path to android.jar - it doesn't like the space in the RAD Studio directory name, at least that's my guess thus far.

      Delete
  4. Have you worked out yet why the Alert View doesn't show in the iOS7 simulator?

    ReplyDelete
  5. Hmm. I feel a bit wrong-footed here. Was this something that came up in my session that I've since forgotten? Or is this some other "common issue" that I'd've bumped into had I done much iOS stuff since the v7 OS update came out (which I haven't)?

    ReplyDelete
    Replies
    1. The latter.. I figured apparently being pretty much on the bleeding edge you may have encountered it. I guessed wrong!

      I also thought you may have had the same enquiry from others..

      Delete
    2. No, I've been playing more with Android, so haven't seen this issue. This is a general problem with UIAlertView not showing up in the iOS simulator is it? Not related specifically to Delphi then, I assume?

      Delete
    3. I haven't been able to find anything to suggest it is a general problem, so I suspect it *may* be specific to Delphi; I'm just not sure why.

      Even using the Alert View example from your APIStuff project in the HelloCocoaWorld project (I replaced the code in the buttonPressed method) results in the Alert View not being shown, so I can't blame it on FireMonkey :-)

      Delete
    4. It's fixed in Delphi XE5 UP 2, according to this fix list: http://edn.embarcadero.com/article/43522

      Delete
  6. Hi Brian, i got i have get test_classes.dex but when i try to merge this error come out :

    java -cp "C:\Users\Public\Documents\RAD Studio\12.0\PlatformSDKs\adt-
    bundle-windows-x86-20130522\sdk\build-tools\android-4.2.2\lib\dx.jar" com.android.dx.merge.DexMerger "C:\Program Files\Embarcadero\RAD Studi\12.0\source\DPFAndroidNativeComponents\JavaClasses\output\dex\classes.dex" "C:\Program Files\Embarcadero\RAD Studio\12.0\source\DPFAndroidNativeComponents\JavaClasses\output\dex\t
    est_classes.dex" "C:\Program Files\Embarcadero\RAD Studio\12.0\lib\android\debug
    \classes.dex"

    Merged dex A (16 defs/17,6KiB) with dex B (1207 defs/1307,5KiB). Result is 1223defs/1597,1KiB. Took 0,9s

    Exception in thread "main" java.io.FileNotFoundException: C:\Program Files\Embar
    cadero\RAD Studi\12.0\source\DPFAndroidNativeComponents\JavaClasses\output\dex\c
    lasses.dex (The system cannot find the path specified)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.(FileOutputStream.java:194)
    at java.io.FileOutputStream.(FileOutputStream.java:145)
    at com.android.dx.io.DexBuffer.writeTo(DexBuffer.java:191)
    at com.android.dx.merge.DexMerger.main(DexMerger.java:1076)

    ReplyDelete
    Replies
    1. Well, the error looks quite clear - it says that classes.dex can't be found in the path specified, which looks like a custom-added subdirectory of the Delphi source directory. I guess one of the previous commands has failed to create classes.dex maybe?
      Try running the commands in the batch file one at a time in a command-prompt and see which one fails first.
      Or run the batch file after ensuring there is no @echo off call at the start of it to ensure you get to see all command output.
      Usually these issues are down to the required environment variables not having been set, as you can see from the previous comments.
      Basically you need to work out what caused the custom classes.dex to have its creation prevented.

      Delete
  7. Thank you, Brian Long. I'm very enjoy your sharing.
    I see the barcode sample on it. It give me some guide information for my work.

    ReplyDelete