Jump to content

Phone App *SOLVED with android source included


RobYost

Recommended Posts

I think I remember a thread that addressed this, but I can not find it.

 

I want to create an iPhone app and an Android app that just goes to my website that runs my UniGui application.

 

Does anyone know the easiest way to accomplish this?  I have tried some of the free app builders, with limited success.

 

People want to download an app not navigate to a web page, or add a shortcut to their phone, plus it is another way to advertise.

 

Thanks,

Rob

Link to comment
Share on other sites

If this is the route you want to go, the Delphi option would be to create a firemonkey application, with a TBrowser, which loads the URL of your unigui app on create.

 

I've done this with android and it works as you would expect.

 

Sent from my Pixel using Tapatalk

Link to comment
Share on other sites

Mohammad:  I've tried Android Studio but I couldn't get it to work.  I will look back and see what the problem was, it was a few months ago.

 

Dan: I have XE6 and it won't make an app for the current release of Android.  At this point, I can't afford to update to the latest version of Delphi.

Link to comment
Share on other sites

Mohammad: I went back to my Android Studio and ran it and it worked in the emulator. 

 

I don't know much about android apps, so what I did was email the apk file to myself.  On my phone, I opened the attachment and clicked install.  It added an app on my phone, but when I click on it pops up a message:

 

SimpleLandlord has stopped

X Close

 

Any ideas?

Link to comment
Share on other sites

Got it working...I had uploaded an older apk.

I need to figure out how to upload to google store, but I think I am almost there.

 

Hope this helps someone.

 

 

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.simple_landlord.simplelandlord">
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppFullScreenTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>

styles.xml

<resources>

<style name="AppFullScreenTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>

</resources>

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.simple_landlord.simplelandlord.MainActivity">

<WebView
android:id="@+id/activity_main_webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>

</android.support.constraint.ConstraintLayout>

build.gradle

dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
   exclude group: 'com.android.support', module: 'support-annotations'
  })
  compile 'com.android.support:appcompat-v7:25.0.0'
  compile 'com.android.support.constraint:constraint-layout:1.0.2'
  testCompile 'junit:junit:4.12'
}

MainActivity.java

package com.simple_landlord.simplelandlord;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;



public class MainActivity extends ActionBarActivity {
  private WebView mWebView;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mWebView = (WebView) findViewById(R.id.activity_main_webview);
    WebSettings webSettings = mWebView.getSettings();
    mWebView.setInitialScale(1);
    mWebView.getSettings().setLoadWithOverviewMode(true);
    mWebView.getSettings().setUseWideViewPort(true);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.loadUrl("https://YOUR_URL/m");
  }
}
  • Like 1
Link to comment
Share on other sites

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...