Is RadPHP good to go to build apps? - android

Yesterday I tried RadPHP, it looks very similar to Delphi with it's properties which is very nice.
I set-up some demo app to test it and after compiling (to android) it seems to be a compiled app that creates an webview to show HTML content. Sounds a littlebit weird to me or isn't it?
Does RadPHP creates a similair package for iOS or is this a real native app?
I cannot test it for a iOS version, because i don't have a key and i don't know anything about the compiled format.
If it does, will apple accept the created app?
EDIT/UPDATE:
I have compiled the app (with fake apple-id) which fails ofcourse but generates some C-Objective (.h,.m) files in the output directory. In the directory classes there is a file named AppDelegate.m. When you view the file you can see that it creates a HTML wrapper to a WebView (here is a snippet from the code):
/**
Called when the webview finishes loading. This stops the activity view and closes the imageview
*/
- (void)webViewDidFinishLoad:(UIWebView *)theWebView
{
// only valid if StreambutlerRemoteControl.plist specifies a protocol to handle
if(self.invokeString)
{
// this is passed before the deviceready event is fired, so you can access it in js when you receive deviceready
NSString* jsString = [NSString stringWithFormat:#"var invokeString = \"%#\";", self.invokeString];
[theWebView stringByEvaluatingJavaScriptFromString:jsString];
}
return [ super webViewDidFinishLoad:theWebView ];
}
- (void)webViewDidStartLoad:(UIWebView *)theWebView
{
return [ super webViewDidStartLoad:theWebView ];
}
/**
* Fail Loading With Error
* Error - If the webpage failed to load display an error with the reason.
*/
- (void)webView:(UIWebView *)theWebView didFailLoadWithError:(NSError *)error
{
return [ super webView:theWebView didFailLoadWithError:error ];
}
/**
* Start Loading Request
* This is where most of the magic happens... We take the request(s) and process the response.
* From here we can re direct links and other protocalls to different internal methods.
*/
- (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
NSURL *url = [request URL];
if ([[url scheme] isEqualToString:#"http"] || [[url scheme] isEqualToString:#"https"]) {
return YES;
}
else {
return [ super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ];
}
}
CONCLUSION:
It will be a native app but is a wrapper to Webview (not all is native). It does exactly the same like said in the accepted answer. All mobile apps will be created using a Webview. I think RadPHP is only useful when you like the programming interface but is not necessary to create mobile apps (you can use phonegap directly instead). In the examples of RadPHP you still need a mac to create the app (you need XCode).
Apple accepts phonegap generated applications but it still not sure if it made it to the AppStore, it depends on what you doing with it. I think simple apps will made it.
See also: http://www.phonegap.com/faq
NOTICE on HTML produced by RadPHP
It is not W3C.

RadPHP uses PhoneGap to package up your app as an Android, iOS or Blackberry app. It generally works the same way for all three of those mobile platforms.

Related

How can i embed an NativeScript Angular app in iOS / Android and navigate to certain routes from the existing app

We are looking to integrate NativeScript Angular into existing iOS and Android apps. We would like to have existing menus in our app be able to route to sections of the NS Angular app. /home /contact for example. One of our concerns with embedding an NS Angular app is the large overhead for frameworks / vendor files / etc and having to duplicate these sections over and over for multiple embedded apps. We would rather have one NS Angular app that contains various views and be able to navigate to those views as the starting view based on the initial link tapped in the previous Native app that hosts the embed.
Has anyone achieved this already and can share some examples or any info that would help? Would sending a variable from the native app to the embedded NS Angular app that routes be on option?
in https://github.com/NativeScript/sample-ios-embedded/blob/master/HOWTO.md
there is mention of _runScript
- (void)activateNativeScript:(id)sender {
NSString *source = #"var application = require('application');"
"application.start({ moduleName: 'main-page' });";
[self _runScript: source];
}
Would we be able to send routes through _runScript or possibly initialize various sections but still maintain the same vendor bundle.js ?
thanks!
I don't think you could access Angular from outside Angular context. A workaround could be, store the RouterExtensions reference on global variable while your appcomponent.ts is initiated,
export class AppComponent {
constructor(private routerExtensions: RouterExtensions) {
(<any>global)._routerExtensions = routerExtensions;
}
}
You may do this with _runScript then
NSString *source = #"global._routerExtensions.navigate([...])";
But make sure you access _routerExtensions once it's initialised. Also the code to start Angular app is slightly different, you will find it in the same docs if you go down a little further.
- (void)activateNativeScript:(id)sender {
NSString *source = #"var platform = require('nativescript-angular/platform');"
"var AppModule = require('./app.module' });"
"platform.platformNativeScriptDynamic().bootstrapModule(AppModule);";
[self _runScript: source];
}

Stuck solution for my cordovaFile / cordovaFileTransfer trial, still Error

Anybody success to use the plugin cordovaFile & cordovaFileTransfer?
I have failed to understand and failed miserably execution. Case wants to make the upload and download controller. Each tested via the browser, it always appears File / FileTransfer is not defined in Firebug. When I made to console.log as:
console.log($cordovaFile); or
console.log($cordovaFileTransfer); or
console.log($cordovaFileTransfer.download); or
console.log($cordovaFileTransfer.upload);
Its return true, form of the {object}.
But when I call their methods included parameters, for example:
$cordovaFileTransfer.download (urlServer, fileTarget, {}, true);
Direct emerge error: FileTransfer is not defined.
I tried to move the download function to the Service, and then Controller call the function (the umpteenth time search results on google). The result is just the same, the above error.
Because there are user in some forum said should / could only be tested through the device, finally I try to upload ionic.io & I sync via APL ionic view on my Smartphone. But the result is NOTHING.
I tried to improvise a little, try method checkDir / checkFile as follows:
.controller('PhotoCtrl', function($scope, $cordovaFile) {
$scope.downpic = function(){
$cordovaFile.checkDir("/sdcard/storage/emulated/0/").then(function(result){
alert("wow");
}, function(err){
alert("eror");
});
}
})
It turns out alerts that appear "error", I try mutually value directory is as follows:
file///sdcard/storage/emulated/0/
file///storage/emulated/0/
/storage/emulated/0/
Just the same error alerts, the chain problem. My question :
What is the application of ionic cordova can access the internal
storage? (I only have the Mobile Internal Storage, without External
Storage);
I was looking for information about AndroidManifest.xml
uses-permission, the permission is only for external storage. Are
there any other analysis?
Please help, really newbie
Finally, I just got the clear solution from the link below :
https://www.thepolyglotdeveloper.com/2014/09/manage-files-in-android-and-ios-using-ionicframework/

C++ Builder WSDL client for Android

I'm having a confusing problem. I'm trying to make a Web cleint that uses WSDL.
I'm using C++ RAD Studio 10 Seattle, but the same problem occured in RAD Studio XE8(older version).
1.I create a Multi-Device Application, add one Edit component and one Button.
2.I create a WSDL Importer by changing the location of the WSDL file to : "http://www.w3schools.com/webservices/tempconvert.asmx?WSDL" and leave all other setting to default.
3.On ButtonClick event of the button I write two lines of code :
_di_TempConvertSoap Converter = GetTempConvertSoap(true,
"http://www.w3schools.com/webservices/tempconvert.asmx?WSDL");
Edit1->Text = Converter->CelsiusToFahrenheit("32");
So after these three steps I have one unit, which is the main Unit with the Form and with the button event. And one file "tempconvert.cpp" that the WSDL Importer has generated. It quite actually just translates the WSDL code to a C++ one and defines the method to communicate with the server. In my case I have two methods : FahrenheitToCelsius() and CelsiusToFahrenheit(), in the example I use CelsiusToFahrenheit().
I compile it to 32-bit Windows platform, run it and when I click the button, the result "89.6" appears in the text of the Edit component. So this is working as expected.
But when I change the target platform to "Android" and use my mobile phone "Samsung GT-I8262" with Android 4.1.2 and run the project, it just stops and exits. I debugged the problem and it stops at the first command in "tempconvert.cpp" in RegTypes() method.
// ************************************************************************
//
// This routine registers the interfaces and types exposed by the WebService.
// ************************************************************************ //
static void RegTypes()
{
/* TempConvertSoap */
InvRegistry()->RegisterInterface(__delphirtti(TempConvertSoap), L"http://www.w3schools.com/webservices/", L"utf-8");
InvRegistry()->RegisterDefaultSOAPAction(__delphirtti(TempConvertSoap), L"http://www.w3schools.com/webservices/%operationName%");
InvRegistry()->RegisterInvokeOptions(__delphirtti(TempConvertSoap), ioDocument);
/* TempConvertSoap.FahrenheitToCelsius */
InvRegistry()->RegisterMethodInfo(__delphirtti(TempConvertSoap), "FahrenheitToCelsius", "",
"[ReturnName='FahrenheitToCelsiusResult']", IS_OPTN);
/* TempConvertSoap.CelsiusToFahrenheit */
InvRegistry()->RegisterMethodInfo(__delphirtti(TempConvertSoap), "CelsiusToFahrenheit", "",
"[ReturnName='CelsiusToFahrenheitResult']", IS_OPTN);
/* TempConvertHttpPost */
InvRegistry()->RegisterInterface(__delphirtti(TempConvertHttpPost), L"http://www.w3schools.com/webservices/", L"utf-8");
InvRegistry()->RegisterDefaultSOAPAction(__delphirtti(TempConvertHttpPost), L"");
}
#pragma startup RegTypes 32
Does someone have any idea why this might be happening? I tried on two other Samsung phones and it didn't work. The error that shuts the program down is "Segmentation fault(11)", and more precisely it stops at the following line of code in "System.pas" file :
u_strFromUTF8(PUChar(Dest), MaxDestChars, DestLen, MarshaledAString(Source), SourceBytes, ErrorConv);
Here is some info that I've found about the function:
u_strFromUTF8 - function that converts a UTF-8 string to UTF-16.
UCHAR is a Byte(in Delphi), so PUCHAR is a pointer to Byte.
I cannot se what could possibly go wrong with this function which apparently only converts a string.
So my question is why does the project work on Windows 32 bit version, but on Android it throws Segmentation fault(11)?
I hope I could find a solution for this problem. I will keep looking.
Thank you,
Zdravko Donev :)
UPDATE:
I disassembled the line:
InvRegistry()->RegisterInterface(__delphirtti(TempConvertSoap), L"http://www.w3schools.com/webservices/", L"utf-16");
to get :
TInvokableClassRegistry *Class = InvRegistry();
TTypeInfo *Info = __delphirtti(TempConvertSoap);
UnicodeString Namespace = "http://www.w3schools.com/webservices/";
UnicodeString WSDLEncoding = "utf-8";
Class->RegisterInterface(Info, Namespace, WSDLEncoding);
And I saw that the problem occurs when calling InvRegistry() function, but I still haven't found the problem as I cannot reach the source code of the function.
I found a solution.
I deleted the line
#pragma startup RegTypes 32
and called the method RegTypes() on my own when I create the form and it worked.

Running JavaScript on current page once loaded from a Firefox for Android add-on

I am wanting to run JavaScript on each and every page that is loaded within the browser. The JavaScript should only be run after the page is loaded and needs to access all elements within the DOM.
I am able to successfully execute the following JavaScript within Scratchpad, although having problems porting it over to my bootstrap.js.
// Use the current content window as the execution context.
// To make properties defined by scripts executing on the page
// available to your sandbox script, use content.wrappedJSObject
// instead.
let context = content;
// Create the Sandbox
let sandbox = Components.utils.Sandbox(context, {
// Make properties of the context object available via the
// script's global scope
sandboxPrototype: context,
// Wrap objects retrieved from the sandbox in XPCNativeWrappers.
// This is the default action.
wantXrays: true
});
// The script that will be executed:
let script = "document.body.style.background = 'red'; alert('test')";
// Evaluate the script:
Components.utils.evalInSandbox(script, sandbox,
// The JavaScript version
"1.8",
// The apparent script filename:
"zz-9://plural/zed/alpha",
// The apparent script starting line number:
42);
Could anyone kindly shed some light as to where exactly the above code needs to be placed within the bootstrap.js?
You need to make a framescript out of it, this is complete example, your script that will execute in the DOM should go into the contentscript.js file: https://github.com/Noitidart/modtools
If you use the addon-sdk, it handles this for you, I prefer not to though thats why my repo linked above does it this way.

Can an app be made that (upon clicking the icon) simply loads a page in the browser?

I've built a mobile-ready website that does most of the features that an app would do. However, some people still like the idea of an 'app' on their phones because it would load the 'app' (website) directly, rather than having them load their browsers and type the URL.
Is there a way to create an app in Android and in iOS that works this way? The idea is that there's simply a custom icon reflecting the website, and once it's tapped it loads the browser with the URL of the website already input.
It seems like it would be simple enough to do in both Android and iOS, but scrolling through my reference books only yields concepts like putting a clickable URL inside a 'main screen' in the app, rather than effortless redirection.
For iOS a "mobile web shell" kind of applications will get rejected in the app review process.
From App review guidelines document (you will require to login with your AppleId),
2.12 Apps that are not very useful, unique, are simply web sites bundled as Apps, or do not provide any lasting entertainment value may be rejected
Which means that applications which merely wrap a UIWebView to display the mobile site and do not support any other functionality/purpose will be rejected. Such shell applications can be achieved even through Safari browser which allows to "Add website to Home screen".
There is similar question asked previously on SO, please go through it: Does Apple reject “mobile web shell” applications?
Hope this helps!
For Android, I would say the comment by #A--C is correct. What you can do to improve the user experience is that have just one activity which is transparent. In the onCreate function have a progress dialog showing some message. Since its transparent it will only show the dialog. Then from within the onCreate just open the browser. It will seem to the user that you are just opening the browser. For making that single transparent activity do following:
<activity android:name=".your.activity.declaration.here"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
Basically add android:theme="#android:style/Theme.Translucent.NoTitleBar" to your activity declaration in manifest.
If you wanted to build a native iOS app, you could use a simple UIWebView to load the page.
As an example, inside your root UIViewController:
NSString* url = #"http://google.com";
NSURL* nsUrl = [NSURL URLWithString:url];
NSURLRequest* request = [NSURLRequest requestWithURL:nsUrl cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:30];
[self.webView loadRequest:request];
As a disclaimer, I have absolutely no idea if apple would accept this for the app store, but to implement such a thing is extremely simple. Here is the only code I changed in the appDelegate:
#import "AppDelegate.h"
#import "WebViewController.h"
#implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
WebViewController *webVC = [[WebViewController alloc] initWithURLString:#"http://www.google.com"];
self.window.rootViewController = webVC;
[self.window makeKeyAndVisible];
return YES;
}
I then subclassed a UIViewController with the following .h and .m files:
#import <UIKit/UIKit.h>
#interface WebViewController : UIViewController <UIWebViewDelegate> {
NSString *_url;
}
- (id)initWithURLString:(NSString *)URLString;
#end
#import "WebViewController.h"
#interface WebViewController ()
#end
#implementation WebViewController
- (id)initWithURLString:(NSString *)URLString {
self = [super init];
_url = URLString;
return self;
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.frame];
webView.autoresizingMask = UIViewAutoresizingFlexibleHeight + UIViewAutoresizingFlexibleWidth;
webView.delegate = self;
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:_url]]];
[self.view addSubview:webView];
}
-(void)webViewDidStartLoad:(UIWebView *)webView {
// perhaps show some sort of loading message here
}
-(void)webViewDidFinishLoad:(UIWebView *)webView {
// hide the loading message here
}
-(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
// also hide the loading message here and present the user with an appropriate error message
}
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
return YES;
}
#end
This resulted in the following:
Hope that helps!

Categories

Resources