Quantcast
Channel: Delphi Forum - Delphi Programming Kings of Code - Delphi Android And IOS
Viewing all 54 articles
Browse latest View live

Using Bluestacks as emulator

$
0
0
 When developing for Android if you don’t have any real Android device, you can use its own emulator Android Virtual Device (AVD),  which comes with Android SDK package. Even you are using Delphi, Android Software Development Kit, Eclipse/Android Studio or any other tool, using that emulator is a pain.So, here we come with You can't view the links! Click here to register. It´s was one of the first Android emulators and it is particularly focused on games, take a look at download page and you will see. Because of this (game oriented) we can take a great performance when using our applications. Almost everything will work with BS, from audio to GPS (simulator), screen rotation and others. Also, is possible to root BS. You will be required to enter your Google account, as a normal Android device, doing that you will be able to download any available application from Google Play Store.Bluestacks comes with an special launcher but it also have the Google PlayStore, so you can download anyother launcher you want, such Nova Launcher, Google Now Launcher, etc. I do really advise to install another launcher Smile – bellow my BS with Nova Launcher. Is possible to change screen size/resolution by touching on Windows Registry.


İmage

 Once installed, you can now load Delphi. You will see that it will appear as a new device on the target list (Android SDK) at Project Group tree named as emulator-5554 (5554) or similar. Sometimes BS will not show up on target device, so I used to kill adb.exe from running and it will apear as soon adb.exe re-run – do that, if necessary, when Delphi is running.Bluestack is running into Debug mode as default, if you need for some reason disable the developer options you will need to install any USB debug application to bring the developer options panel.Now, it is important to understand that BS is an Intel processor emulator. That said, you will need to uncheck the libnative-activity.so on Project Deployment – I do uncheck all three libs, but x86 would be ok:
İmage

 If you forget this, your application will show up a black screen telling it is an incompatible device. This is also useful when deploying for other real devices powered by Intel processors (Galaxy Tab 2, Asus Zenfone 5, Zenfone 2 and others). The magic is done because of libhoudini, the Intel’s You can't view the links! Click here to register.Once on Delphi, you can now debug and deploy your application. As you can see BS screen act as a tablet, but as I told you can modify the registry keys and alter its size (You can't view the links! Click here to register).Next post I will show you how to fix an anoying problem with statusbar on Intel processors.[UPDATE] You can try using You can't view the links! Click here to register which is an universal driver if anything else fails. For that, uninstall your previous driver first.Happy programming!

 

Touching the root

$
0
0
Probably for the most of situations your application will not require root access to the system. But, who knows why, sometimes you maybe need it. When developing my new application someone asked for a special feature: save the WiFi password which you are connected to. Well, you can get some of the wireless SSID infomation by calling the correct API functions, but not the password. The password is, so far,  storaged into the wpa_supplicant.conf file and to have access to it you will need root privileges. Of course someone can simple type in the password and it’s done.So, for this case, more than run away from the solution I was curious in how could I get root access from my application. After dinging a while I got a solution by watching a You can't view the links! Click here to register video from “Marijsoft sviluppo software”, that he was kind for provide new links for the source code, that I tested on XE8 and DX Seattle and worked as expected.By reading the files (Androidapi.JNI.Runtime, Androidapi.JNI.Stream2and FMX.Android.Runtime) we will discover that source belongs to 天轶_黄金 SmileI needed to do a little fix on it (?) so I was able to make it work as I expected. I guess someone else can really improve this code, but for my purpose it is enough now. You can download the required files You can't view the links! Click here to register (fixed by me), and the original one You can't view the links! Click here to register (while it exists there). Basically you will find 2 functions:
  • HaveRoot():boolean
  • RunAndroidCmd(string, boolean, TStrings)
The first will invoke an internal attempt to run “su” and returning true if success. The second one you could use to reboot the device, if you want, example: RunAndroidCmd(‘su’ + sLineBreak + ‘reboot’, true). This command function will allow you run any Android linux compatible commands, such chmod, rm, kill applications etc., so you can use it to make a party on your device, so be careful.İmage
You can't view the links! Click here to register. Once allowed by SuperSu, my application can have root access. Here I made a simple program to read the wpa_supplicant.conf(Memo1.Lines.ReadFromFile(<fullfilename> was enough) and voilà!

İmage
At this point you application can handle the device with root privileges and now can manipulate whatever you want. Does I told you to be careful already?

 

 

Misalignment status bar on Intel based devices

$
0
0
İmageOne problem we can face when deploying for Intel based devices is a misalignment that can occurs on status bar. This issue can be observed on Bluestacks too, as you can see (that black strip is actually the status bar).After asking for help on I received a nice solution from Hsu Neptune, a member from the great community You can't view the links! Click here to register at Google Plus, managed by Lars Fosdal. Hsu Neptune pointed the You can't view the links! Click here to register, but he was kind enough to explain in plain english :)Well, there he advices that this fix should be used on Delphi XE8 (not C++ Builder – for that see the original post, bellow). I was able to ask for a test on Delphi Seattle (that also carries the same problem) and it works there. He is the fix:1. Copy FMX.Platform.Android.pas to your project’s folder and Add to the project.
2. Open FMX.Platform.Android.pas and search for ” function TWindowManager.RetrieveContentRect: TRect; ”
3. Modify the code:


 
PHP Code:
function TWindowManager.RetrieveContentRectTRect;
var
 
ActivityJActivity;
 
NativeWinJWindow;
 
DecorViewJView;
 
ContentRectVisibleContentRectJRect;
begin
 Activity 
:= SharedActivity;
 if 
Activity <> nil then
 begin
 NativeWin 
:= Activity.getWindow;
 if 
NativeWin <> nil then
 begin
 FStatusBarHeight 
:= FNewContentRect.top;
 
ContentRect := TJRect.Create;
 
DecorView := NativeWin.getDecorView;
 
DecorView.getDrawingRect(ContentRect);
 
// Fix by Flying Wang &
 
CallInUIThread(
 
procedure
 begin
 
if (not PlatformAndroid.GetFullScreen(nil)) and (SharedActivity.getWindow.getAttributes.flags and
 
TJWindowManager_LayoutParams.JavaClass.FLAG_FULLSCREEN <> TJWindowManager_LayoutParams.JavaClass.FLAG_FULLSCREENthen
 begin
 
// http://www.2cto.com/kf/201307/227536.html
 
ContentRectVisible := TJRect.Create;
 
DecorView.getWindowVisibleDisplayFrame(ContentRectVisible);
 if (
ContentRect.top 1) or (ContentRectVisible.top FStatusBarHeightthen
 begin
 ContentRect
.top := ContentRectVisible.top;
 
FNewContentRect.top := ContentRectVisible.top;
 
FStatusBarHeight := FNewContentRect.top;
 
end;
 
end;
 
end);
 
Result := TRect.Create(Round(FNewContentRect.left FScale), Round(FNewContentRect.top FScale), Round(ContentRect.right FScale),
 
Round(ContentRect.bottom FScale));
 
end;
 
end;
end
4. Re-compile the project and deployNow you will get this:
İmage
 

How to Vibrate Android or Iphone

$
0
0
Uses 

{$IFDEF ANDROID}
  ,Androidapi.JNI.Os,
  Androidapi.JNI.GraphicsContentViewText,
  Androidapi.Helpers,
  Androidapi.JNIBridge
{$ENDIF}
{$IFDEF IOS}
  ,IOSapi.MediaPlayer,
  IOSapi.CoreGraphics,
  FMX.Platform,
  FMX.Platform.IOS,
  IOSapi.UIKit,
  Macapi.ObjCRuntime,
  Macapi.ObjectiveC,
  iOSapi.Cocoatypes,
  Macapi.CoreFoundation,
  iOSapi.Foundation,
  iOSapi.CoreImage,
  iOSapi.QuartzCore,
  iOSapi.CoreData
{$ENDIF}
  ;

{$IFDEF IOS}
Const
  libAudioToolbox        = '/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox';
  kSystemSoundID_vibrate = $FFF;

Procedure AudioServicesPlaySystemSound( inSystemSoundID: integer ); Cdecl; External libAudioToolbox Name _PU + 'AudioServicesPlaySystemSound';
{$ENDIF}



//In your Application

procedure TForm1.Button1Click(Sender: TObject);
{$IFDEF ANDROID}
Var
  Vibrator:JVibrator;
{$ENDIF}
begin
{$IFDEF ANDROID}
  Vibrator:=TJVibrator.Wrap((SharedActivityContext.getSystemService(TJContext.Java​Class.VIBRATOR_SERVICE) as ILocalObject).GetObjectID);
  // Vibrate for 500 milliseconds
  Vibrator.vibrate(500);
{$ENDIF}
{$IFDEF IOS}
  AudioServicesPlaySystemSound( kSystemSoundID_vibrate );
{$ENDIF}
end;
 

INTEGRATING APPLICATION DELPHI XE7 ANDROID WITH WHATSAPP

$
0
0
Understanding and encoding

Basically we EDIT1 in a text that will be delivered to Whatsapp for when selecting contact him the message is sent. Now that we have the concept we code.
Remember that we must once again make use of namespaces orUnits for use of Android features in Delphi, for such in theimplementation section enter the:
Implementation

 {$ R * .fmx}
 uses
   FMX.Helpers.Android, Androidapi.Jni.GraphicsContentViewText,
   Androidapi.Jni.Net, Androidapi.Jni.JavaTypes, idUri, Androidapi.Jni,
   Androidapi.JNIBridge, Androidapi.Helpers; 
After that, in the OnClick Button1 we enter the code below:
procedure TForm1.Button1Click (Sender: TObject);
 var
   IntentWhats: JIntent;
   message: string;
 begin
   Then if Edit1.Text.IsEmpty
     message: = 'Whatsapp sending test with Delphi XE7.  '+ # 13 +
         'Read more in You can't view the links! Click here to register'
   else
     Message: = Edit1.Text;


   IntentWhats: = TJIntent.JavaClass.init (TJIntent.JavaClass.ACTION_SEND);
   IntentWhats.setType (StringToJString ('text / plain'));
   IntentWhats.putExtra (TJIntent.JavaClass.EXTRA_TEXT,
       StringToJString (message));
   IntentWhats.setPackage (StringToJString ('com.whatsapp'));
   SharedActivity.startActivity (IntentWhats);

 end; 

Android SDK bits missing

$
0
0
In the Android SDK settings, some things are mising, like Zipalign, Adb location...

Any idea how to fix this?

İmage

 

Problems Andorid And Delphi 10 Seattle

$
0
0
I would like to share some problems that I am having in ofder to know wheter you are having them as well.

Android, some apps are working fine when compiled with XE8.

However, in Seattle:
    1.- Android, release, they do not work. App close itself when starting.
    2.- Android, debug, apps run well.
    3.- Windows, no problems at all

Are you having these problems?. I have the same issues in many apps.

Any idea of whay is happening?

Thankls in adavnce.

 

Let me axplain better than tha apps run fine when compiled in XE8. Then I open the project in XE10 and in release mode they do not run.

 

ZeroPlayer DelphiDX Full Source

$
0
0
Selam. Belki lazımınız olur siteden video oynatmak için ek jar kütüphane. Direk link ve M3U linkleri destekler.

Hide Post

DelphiDX - ZeroPlayer Library for Android

$
0
0
Selam. Belki lazımınız olur siteden video oynatmak için ek jar kütüphane. Direk link ve M3U linkleri destekler.

Hide Post


 

Meeseeks scripting language for Android

$
0
0
Hi folks,

I'm putting available in public domain a small library I made to embed scripting in Delphi XE7 apps for Android. I called it Meeseeks because it's supposed to work quite like the cartoon character, scripts are created to help the execution of some small tasks or computations in the host application, producing the results and expiring just after.

The script language is similar to old fashioned structured BASIC, do not expect any fancy syntax, but it works fine to the purpose described above. It's possible to easily extend the existing language's libraries or create new libraries by integration with Delphi methods, I included some examples and wrote some material about how to do it, just look for it in my website, the links are available in the Github page.

By the way... the link to the Github page is here: You can't view the links! Click here to register 

I have to talk a little bit about the test projects. If you read the website material, you will realize there are four small projects used to explain the library details, as for example, how to integrate the library files in new Delphi projects and how to extend it. There are two bigger projects which are the Meeseeks boxes. Those were written to demonstrate a Delphi application using all the currently available resources of the library. There are two "Meeseeks box" applications, one including the database utilities and another one not including it. The reason for that is that the database library was written using You can't view the links! Click here to register, which is a third party tool I cannot include in my materials because it does not belong to me.

This project was written focusing in Delphi apps for Android, but I think with some minimal efforts it could be adapted to other operating systems. It was tested using the XE7 version of RAD Studio, I do not have access to any other version of it, so I don't know if changes have to be made in order to compile the project in a different version of RAD Studio.

The reason to create this project was that I needed such functionality to an application I had to develop. There are scripting solutions freely available in the web, but generally such solutions are more complex and/or do not focus solely in Android. Meeseeks lacks a lot of resources available in nowadays scripting languages but it is small (you could use just the standard library of functions, that means two files added to the Delphi project with about 9K source lines including comments), easy to understand, reasonably fast and does what I needed at the occasion.

I hope it can be useful to someone else like it is for me.

Last comments... I was able to publish a "Meeseeks Box" version (database functionalities included) in the Google Play Store, I had to change (obviously) the names, images and even the comments inside the demo scripts, but it was accepted and is now available for install (and it was written 100% in Delphi, the programming language I "love to love" and many others seems to "love to hate").

You can't view the links! Click here to register

For other problems maybe what you need is a "Fleeseeks Box", but this would be another project.

My best wishes for all of you folks.


 

 

Delphi Android Native VideoView

$
0
0
Merhaba. Delphi Android Native VideoView çağırmak istiyorum. Amma başarısız oldum. Sorunda vermiyor.
PHP Code:
CallInUIThread(
    
procedure
    
var
      
DMJDisplayMetrics;
      
VideoViewJVideoView;
      
NativeLayoutJNativeLayout;
    
begin
      DM 
:= GetJDisplayMetrics;
      
VideoView := TJVideoView.JavaClass.init(SharedActivity);
      
VideoView.setMinimumWidth(DM.widthPixels);
      
VideoView.setMinimumHeight(DM.heightPixels);
      
VideoView.setVideoPath(StringToJString('http://techslides.com/demos/sample-videos/small.3gp'));
      
VideoView.requestFocus();
      
VideoView.start();
      
NativeLayout := TJNativeLayout.JavaClass.init(SharedActivityMainActivity.getTextEditorProxy.getWindowToken);
      
NativeLayout.SetPosition(1010);
      
NativeLayout.SetSize(300300);
      
NativeLayout.SetControl(VideoView);
      
NativeLayout.SetFocus(true);
    
end); 
 

 

 

Print to epson tm t88v m129h from Delphi Firemonkey (android)

$
0
0
Hello,

I need some help. Does anyone know how to print directly to epson tm t88v m129h POS printer from Delphi Firemonkey (android) application?

Thanks in advance.

Joe

 

 

EAGLE EYE PUZZLE GAME FULL SOURCE

DelphiDX - BroadcastReceiver Library

$
0
0
Hi. BroadcastReceiver Library project. Tested Delphi Berlin.

Hide Post

Lucky Donkey Race Full Source


Delphi/Android: Right To Left support

$
0
0
We are using Delphi XE8 to build an Android application.
We need support for Right To Left languages such as Arabic.

The problem is that native components does not support BiDi mode.
word such as مرحبا appears as م ر ح ب ا and from left to right!

There is the "DPF components for Android" ( https://sourceforge.net/projects/dpfdelphiandroid/ ) 
but: only up to XE7. and there is no grid component.

The author has done a great job and we thank him for this but the grid component is very important to my work. 

Could anyone help us please if he nows another set or a trick for BiDi support !

Note: we contancted TMS and they also do not have any plan for a future BiDi support untill Delphi has>

Thank you all

 

 

CCR.PrefsIniFile for Android

$
0
0
Implements TCustomIniFile descendants (TAndroidPreferencesIniFile and TApplePreferencesIniFile) that delegate to the native app preferences API on Android, iOS and OS X. A factory function is also provided to allow easily creating a TCustomIniFile instance without worrying about the platform (Android/iOS/OS X/Windows).

Usage You can't view the links! Click here to register


 

Barcode for FireMonkey 2.4

$
0
0
Delphi and C++ Builder barcode component for FireMonkey.

- uses Zint Barcode Generator
- supports over 50 symbologies including Code 128, Data Matrix, USPS OneCode, EAN-128, UPC/EAN, ITF, QR Code, Code 16k, PDF417, MicroPDF417, LOGMARS, Maxicode, GS1 DataBar, Aztec, Composite Symbols and more
- supports Windows 32, Windows 64, OS X, iOS and Android
- available for Delphi/C++ Builder XE2 - 10.1
- source code included in full version
- royalty free distribution in applications


 

how to make right to left android application

$
0
0
hi all
when i rename button in arabic language
example
button1.text:='ماهر';
it appear 'ر ه ا م' when running the application in android device
all firemonkey version does not support right to left android applications
any one can help me with this problem ?
note : i don't won't D.P.F components

Firemonkey Android Application Source - Includes Splash Screen & Progress Dialog

$
0
0
I was tired to search a complete firemonkey application with source for educational purposes but as you guess I couldn't find İmage  
​So I have developed one and decided to share it  İmage​   This android application simply  finds Prime Numbers between a start and a stop numbers you give.
​(A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself. For example 7)
​Application includes a nice splash screen with lightbox effect based on Framestand component and a professional progress dialog based on FGX (fgx_0.7.1.118).
It also contains​ a custom dialog box appears when teminating the application. 
​(Ps. .apk file is included in Bin folder) 

​Here is the source :


 

 

 
Viewing all 54 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>