7

From August 2018, all new apps on Google Play must target Android 8 (API level 26) or higher, and from November 2018, all app updates on Google Play must of the same apps on Google Play.

Right now the only way you have to upload a new App that target Android 8 is to edit the file AndroidManifest.template.xml and replace targetSdkVersion = "% targetSdkVersion%" by: Android: targetSdkVersion = "26"

The problem is that from that moment the app has the restrictions introduced by Android O. The permissions considered as dangerous (camera, location, SMS, ...) will not be granted to the app by the mere fact of including them in the AndroidManifest file. Goodbye to the camera, to the GPS, ...

In this web, you can following a few simple steps to start requesting permissions from the user: http://delphiworlds.com/2018/05/targeting-android-8-and-higher/

HOWEVER, target Android 8 has many more implications. My application, for the mere fact of changing the targetSDKVersion from 25 to 26 DOES NOT RECEIVE PUSH NOTIFICATIONS when the application is not running (or in background).

My test is simple: I change the targetSDK and it does not work anymore. I rewind and it works again, both with the app running and with the app in background or closed.

The key is the change of TARGETSDKVERSION because I have always tried selecting the SDK 24.3.3 in the SDK Manager.

I think one of the main reasons is the disappearance of the Background Services in Android O, as they explain in https://blog.klinkerapps.com/android-o-background-services/ But I’m not sure.

MY BIG PROBLEM.

I just uploaded an Android 7 (Level 25) app to Google Play. The problem is that as of November 2018 I will NOT be able to upload updates if I do not change TARGETSDKVERSION to Level 26. But if I do ... I will stop receiving PUSH notifications, and without PUSH notifications, my App DOES NOT WORK FOR ANYTHING.

I confess that I'm a little scared with this

I'm sorry for my English.

Thank you VERY much.

7
  • I also asked something similar on embarcadero's forum community.embarcadero.com/forum/installation-issues/…
    – bLight
    May 27, 2018 at 20:02
  • 1
    can you try the ALFirebaseMessagingDemo.apk from github.com/Zeus64 ... i make it working in Android 8 without any problem (however on android 0 take care that you must handle channel)
    – zeus
    May 28, 2018 at 19:05
  • Hello loki. Thanks for your comment. I have observed in github.com/Zeus64/alcinoe/blob/master/demos/… that target sdk is level 22. I have no problem with this level but you can upload anything to Google Play with target level less than 26. Other important problem is how I can implement channels in Delphi
    – Juan M
    May 29, 2018 at 15:48
  • Hello blight. Tweak the android.manifest.template is the first step. The second is explained in the delphiworlds link (but with a extrange white rectangle in some deployed apps). The third step (and my big problem) is develop a notification channel. Without this (and probably more things) you can get push notifications in delphi with android 8)
    – Juan M
    May 29, 2018 at 16:22
  • 1
    Juan, luckily for me, my app doesn't require notifications, the delphiworlds solution is somewhat of an ugly hack, I'm hoping we'll get something official soon, perhaps more of us should notify embarcadero directly.
    – bLight
    May 30, 2018 at 10:57

1 Answer 1

1

You will have to make sure that your notification is a high priority, FCM will post it immediately

FCM attempts to deliver high priority messages immediately, allowing the FCM service to wake a sleeping device when necessary and to run some limited processing (including very limited network access). High priority messages generally should result in user interaction with your app. If FCM detects a pattern in which they don't, your messages may be de-prioritized

If your users interact with the notifcaiton FCM will not delay it. Background services may not be allowed in some cases in Android O but it doesn't mean you cannot send notifications

Also your notification will not be displayed if your not using notification channels, You can use this code to create notification channels

public void initChannels(Context context) {
if (Build.VERSION.SDK_INT < 26) {
    return;
}
NotificationManager notificationManager =
        (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
NotificationChannel channel = new NotificationChannel("default",
                                                      "Channel name",
                                                      NotificationManager.IMPORTANCE_DEFAULT);
channel.setDescription("Channel description");
notificationManager.createNotificationChannel(channel);

}

1
  • Thank you very much Suhaib but I need the way to implement that in Delphi. Its not an easy task
    – Juan M
    May 29, 2018 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.