Jump to content
Sign in to follow this  
oakley

Notification demo android 12

Recommended Posts

Hi everyone,

 

I am trying to deploy the crossplatform notification demo on android 12 according to the readme.md file coming along in the same folder as the project file.

As soon as I hit the "start service" button, the service is not started and the app closes.

 

I already tried to get some substantial info by starting monitor.bat but without success.

 

Rgds

 

Mirko

 

 

 

Share this post


Link to post
22 minutes ago, oakley said:

I am trying to deploy the crossplatform notification demo on android 12

If you're referring to this demo: https://github.com/Embarcadero/RADStudio11Demos/tree/main/Object Pascal/Multi-Device Samples/Device Sensors and Services/AndroidNotificationServiceDemo

There seems to be some missing information in the project file because it does not even add the service to the manifest, and the service jar is not listed under the Libraries node of the Android platform in Project Manager. What I did to rectify this was to:

  1. Right-click the Android platform node in Project Manager
  2. Click Remove Android Services
  3. Select the checkbox next to the service in the list
  4. Click Next
  5. Click Finish
  6. Right-click the Android platform node in Project Manager again
  7. Click Add Android Service
  8. Click Next
  9. Select the path to the service, i.e. AndroidNotificationServiceDemo\NotificationService
  10. Click Select Folder
  11. Click Next
  12. Click Finish

Then recompile/deploy/run

 

After you click Start Service, a notification should appear soon after in the system status bar. Opening the notification and tapping on it should open the app and the notification info should appear in the memo

 

 

 

 

Share this post


Link to post

Hello Dave,

 

thanks for the advice but this is not working for me. The manifest is a good point and I took a look at it.

 

Even after re-adding the service I do not see it in the manifest.xml of the main app.

 

<?xml version="1.0" encoding="utf-8"?>
<!-- BEGIN_INCLUDE(manifest) -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.embarcadero.NotificationApp"
    android:versionCode="1"
    android:versionName="1.0.0"
    android:installLocation="auto">
    <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="30" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.INSTANT_APP_FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
    <uses-permission android:name="android.permission.READ_CALENDAR" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
    <uses-permission android:name="android.permission.WRITE_CALENDAR" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <uses-feature android:glEsVersion="0x00020000" android:required="true"/>
    <queries>

    </queries>
    <application
        android:persistent="False"
        android:restoreAnyVersion="False"
        android:label="NotificationApp"
        android:debuggable="true"
        android:largeHeap="False"
        android:icon="@drawable/ic_launcher"
        android:theme="@style/AppTheme"
        android:hardwareAccelerated="true"
        android:resizeableActivity="false"
        android:requestLegacyExternalStorage="true">

<service android:name="com.embarcadero.services.NotificationService" android:exported="false" />

        <!-- 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="NotificationApp"
            android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
            android:launchMode="singleTask">
            <!-- Tell NativeActivity the name of our .so -->
            <meta-data android:name="android.app.lib_name" android:value="NotificationApp" />

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <receiver android:name="com.embarcadero.rtl.notifications.NotificationAlarm" />

    </application>
</manifest>
<!-- END_INCLUDE(manifest) -->

Share this post


Link to post
10 hours ago, oakley said:

<service android:name="com.embarcadero.services.NotificationService" android:exported="false" />

You don't see this part? 😉

 

Share this post


Link to post

Oh dear... yes i see it now. I'am sorry.

But still, the app closes on starting the service.

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
Sign in to follow this  

×