Jump to content
JohnLM

Receiving an 'Unsafe app blocked' message

Recommended Posts

Specs:  Delphi XE7, FMX, Win7, Galaxy s10+ phone Android 12.

 

I've have compile and deployed many apps over to my Android 12 device, galaxy s10+ phone.  Earlier this year (2024) I stopped working on those projects I used to compile in this setup/specs (listed above). 

 

Today, I am trying to deploy an app and now I can not because of the 'Unsafe app blocked message'.  I recall seeing something similar in late Dec/2023 on this phone, but there was a button to allow or not, and now I don't see that on this message screen given on my phone. 

 

How can I resolve this?

Share this post


Link to post

Yes, this one. . . 

 

1041971623_im-googleUnsafeAppBlockedmessage.thumb.png.661c2521ee2012265cd4d7afed374dce.png

 

I get that above message and then it closes on its own, and the app (this time) does not get installed. 

 

In previous deploying to my android 12 device, it would install but I would get a message similiar to above (not exact) but with the option to allow or uninstall--if memory serves me correctly. 

Share this post


Link to post
2 hours ago, JohnLM said:

I get that above message and then it closes on its own, and the app (this time) does not get installed. 

The info at that link literally tells you what the problem is, i.e:

"Reason for this notification: These Play Protect warnings will show only if the app's targetSdkVersion is more than 2 versions lower than the current Android API level. For example, a user with a device running Android 13 (current API = 33) will be warned when installing any APK that targets API level lower than 31. Android Versions and corresponding API levels can be reviewed on the API level page."

 

You would need to change %targetSdkVersion% in AndroidManifest.template.xml to a value less than 2 versions than the target device, i.e. in your case 29 (Android 10), 30 (Android 11), or 31 (Android 12). Not sure if this will work with XE7 - you might need to upgrade, preferably to Delphi 12.

Share this post


Link to post

I've edited the "AndroidManifest.template.xml" file and changed the value in the %targetSdkVersion% field from 11 to 31 but when I re-build it (not deploy it), it is changed back to the default of 11. 

 

I did notice that there are several copies of the "AndroidManifest.xml" file in the Android folder of the project folder, and I have made the same changes, from 11 to 31.

 

But the value reverts back to 11.   I must be updating the wrong file somewhere. 

 

Are there steps that show how to excactly make the necessary changes where and when, etc. ?

Share this post


Link to post
2 hours ago, JohnLM said:

I've edited the "AndroidManifest.template.xml" file and changed the value in the %targetSdkVersion% field from 11 to 31

Most likely you did not edit AndroidManifest.template.xml then, because it does not have a value for targetSdkVersion, it looks like this:

<uses-sdk android:minSdkVersion="%minSdkVersion%" android:targetSdkVersion="%targetSdkVersion%" />

More likely you edited AndroidManifest.xml which is generated in the project output folder. AndroidManifest.template.xml is in the root of the project source.

Share this post


Link to post
Posted (edited)

post #8

 

I believe I am doing things correctly now.   However, it is not working yet.  See below for the XML file that I modified for Delphi XE7, and where I replaced

the var android:targetSdkVersion="%targetSdkVersion%" with android:targetSdkVersion="31". 

<?xml version="1.0" encoding="utf-8"?>
<!-- BEGIN_INCLUDE(manifest) -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="%package%"
        android:versionCode="%versionCode%"
        android:versionName="%versionName%">

    <!-- This is the platform API where NativeActivity was introduced. -->
    <uses-sdk android:minSdkVersion="%minSdkVersion%" android:targetSdkVersion="31" />
<%uses-permission%>
    <application android:persistent="%persistent%" 
        android:restoreAnyVersion="%restoreAnyVersion%" 
        android:label="%label%" 
        android:installLocation="%installLocation%" 
        android:debuggable="%debuggable%" 
        android:largeHeap="%largeHeap%"
        android:icon="%icon%"
        android:theme="%theme%"
        android:hardwareAccelerated="%hardwareAccelerated%">
        <!-- Our activity is a subclass of the built-in NativeActivity framework class.
             This will take care of integrating with our NDK code. -->
        <activity android:name="com.embarcadero.firemonkey.FMXNativeActivity"
                android:label="%activityLabel%"
                android:configChanges="orientation|keyboardHidden"
                android:launchMode="singleTask">
            <!-- Tell NativeActivity the name of our .so -->
            <meta-data android:name="android.app.lib_name"
                android:value="%libNameValue%" />
            <intent-filter>  
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter> 
        </activity>
        <%activity%>
        <receiver android:name="com.embarcadero.firemonkey.notifications.FMXNotificationAlarm" />
        <%receivers%>
    </application>
</manifest>

...and when I compile/deploy to Android, it stops at this part: 

 

1531670059_im-android-unabletocreateprocess-performingstreamedinstall.png.8ad650de56e5e2272b240d3a6c171545.png

 

...and

 

1408303811_im-cannotrunonanandroiddeviceoremulator.thumb.png.d3f9fa1cba1ee664689b93fcde85bce2.png

 

Edited by JohnLM

Share this post


Link to post

Share this post


Link to post
7 hours ago, JohnLM said:

...and when I compile/deploy to Android, it stops at this part: 

Once again, it is telling you the problem, i.e. that it is attempting to install the app with a different signature, and even suggests a solution, i.e. uninstall the original app.

Share this post


Link to post
Posted (edited)

I started a new FMX project for android. I only added an edit box. I did not change the template xml file. I left it alone.  Then I build it, and that was a success.  Then, I compiled/deployed to android. 

 

Result: same issue as in post #8 above. 

 

I just don't understand it. This was working fine before, back in Dec/2023.  And now I can't even compile a small editbox over to android.  So frustrating. 😞 

 

Edited by JohnLM
typo

Share this post


Link to post
1 minute ago, JohnLM said:

I just don't understand it. This was working find before, band in Dec/2023.  And now I can't even compile a small editbox over to android.  So frustrating. 😞 

 

As it was mentioned earlier developing for mobile platforms is a moving target. In case of Android you have to follow the rules that Google sets every year. You cannot use the same tool for years like for Windows. 

  • Like 1

Share this post


Link to post

Make me wish there was a Windows Phone. 

Share this post


Link to post
8 minutes ago, JohnLM said:

Make me wish there was a Windows Phone. 

There were Windows Phones. If you want an environment where the development requirements are not going to change, that's probably your best option.

  • Haha 1

Share this post


Link to post

Success!!

 

Okay.  I figured out what was causing the problem.   I need new glasses.  I could not see the part about the link and clicked "Got it" which does not install. 

 

1. So, I deleted the Android folder from the project folder. 

2. Then, I restored a backup copy of the origianl unaltered "AndroidManifest.template.xml" file. 

3. Compiled/deployed to android.

4. when a "Unsafe app blocked' message appears on the android phone, just above the large blue "Got it" button, click the "More details" link. 

5. when you see additional details display, click on the "Install anyway" link.
6. enter your phones sign-on password

7. a dialog of security questions will appear, I just click the Continue button, bottom right. 

8. another dialog box pops up for "look for updates.." and "ok".  select OK button.

9. app will now load up. -- finished

  • Like 2

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×