Jump to content

create apk


jahlxx

Recommended Posts

32 minutes ago, jahlxx said:

Hi.

Some easy way to create an apk as a url of an unigui application? Any recommended tool?

I need generate app for android and for ios if possible.

Thanks.

 

 

 

 

maybe here @Hayri ASLAN will help :

 

 

I hope all these topics will point you in the right direction for your work. 

In my practice I use Android Studio + WebView + uniGui

Link to comment
Share on other sites

Ok. I'll try. Thanks.

And other question.

I have 2 versions of an delphi + unigui application, one for desktop, and one for mobile (touch).

Is there any way to run the correct one depending the client device?

For example:

When go to the url "www.mydomain.com/myapp" in the web browser, if the client is a computer, go to that url as it is, but if the client is a mobile, go to the url "www.mydomain.com/myapp/m". Is there any option to do that? In the server? in the application? ??

I hope I have been clear enough.

Thanks.

Link to comment
Share on other sites

19 minutes ago, jahlxx said:

Ok. I'll try. Thanks.

And other question.

I have 2 versions of an delphi + unigui application, one for desktop, and one for mobile (touch).

Is there any way to run the correct one depending the client device?

For example:

When go to the url "www.mydomain.com/myapp" in the web browser, if the client is a computer, go to that url as it is, but if the client is a mobile, go to the url "www.mydomain.com/myapp/m". Is there any option to do that? In the server? in the application? ??

I hope I have been clear enough.

Thanks.

Hello, Yes You can !

1. first check when session is created what device is calling you app

If (UniApplication.UniPlatform <> [upDesktop])
 

2. then if is mobile device redirect to www.mydomain.com/myapp/m

procedure TUniMainModule.UniGUIMainModuleCreate(Sender: TObject);
begin

URLRedirected := False;
end;

 

procedure TUniMainModule.UniGUIMainModuleHandleRequest(ASession: TObject;
  var Handled: Boolean);

begin
  If (not URLRedirected)

  AND (UniApplication.UniPlatform <> [upDesktop])
  then begin
    if (UniSession.ARequest.URI = '/HandleEvent')
    AND (TRIM (UniSession.ARequest.Referer) <> '')
    then begin
        mobileURL := StringReplace (UniSession.ARequest.Referer,'www.mydomain.com/myapp','www.mydomain.com/myapp/m',[rfReplaceAll,rfIgnoreCase]);
        UniSession.AddJS('function redirect() {'
                        //clear hash - a from url
                        + '  var url = ' + mobileURL+ ';'
                        + '  var hash = window.location.hash' + 'endss' + ';'
                        + '  var index_of_hash = url.indexOf(hash) || url.length;'
                        + '  var hashless_url = url.substr(0, index_of_hash);'
                        + '  location.href = hashless_url;'
                        + '}'
                        );
        //redirect to www.mydomain.com/myapp/m
        Handled := True;
        UniSession.AResponse.ResponseNo := 308;
        UniSession.AResponse.ResponseText := 'redirected';
        UniSession.TerminateAfterSecs(1);
        URLRedirected := True;
        sleep (2);

        UniSession.UrlRedirect (mobileURL);
    end;
  end;
end;

Link to comment
Share on other sites

  • 6 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...