You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/TODO.md
-1Lines changed: 0 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,7 +77,6 @@
77
77
## Advanced Topics / Under the Hood Updates
78
78
79
79
-[ ] Replace the Marshmallow-era target SDK guidance in `Advanced-Topics-Under-The-Hood.asciidoc` so it documents the current Gradle 8/target SDK defaults instead of claiming the build still targets API 21 by default.【F:docs/developer-guide/Advanced-Topics-Under-The-Hood.asciidoc†L681-L687】【F:maven/codenameone-maven-plugin/src/main/java/com/codename1/builders/AndroidGradleBuilder.java†L637-L663】【F:maven/codenameone-maven-plugin/src/main/java/com/codename1/builders/AndroidGradleBuilder.java†L900-L923】
80
-
-[ ] Update the offline build prerequisites section to match today’s toolchain requirements (managed Gradle 8+, Java 17 via `JAVA17_HOME`) instead of the legacy Gradle 2.11/JDK 8 walkthrough.【F:docs/developer-guide/Advanced-Topics-Under-The-Hood.asciidoc†L500-L579】【F:maven/codenameone-maven-plugin/src/main/java/com/codename1/builders/AndroidGradleBuilder.java†L80-L507】
81
80
-[ ] Refresh the Android permissions mapping to cover new runtime prompts (e.g., `POST_NOTIFICATIONS`, background location) and remove stale entries like `ACCESS_MOCK_LOCATION` so it reflects what the builder and Android implementation request now.【F:docs/developer-guide/Advanced-Topics-Under-The-Hood.asciidoc†L632-L660】【F:maven/codenameone-maven-plugin/src/main/java/com/codename1/builders/AndroidGradleBuilder.java†L123-L299】【F:Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java†L8731-L8734】
@@ -480,152 +480,6 @@ rim.nativeBrowser true/false defaults to false. Enables the native blackberry br
480
480
|Defaults to 48x48. The size of the icon in the format of width x height (without the spacing).
481
481
|===
482
482
483
-
=== Offline Build
484
-
485
-
IMPORTANT: Offline build is an enterprise feature
486
-
487
-
At this time Codename One supports iOS & Android targets for offline builds. We require an Enterprise grade subscription as explained in the sidebar.
488
-
489
-
NOTE: If you signup for Enterprise and cancel you can still do the offline build. You won't be able to update the builder though
490
-
491
-
.Why only Enterprise?
492
-
****
493
-
There are several reasons, the technical one is that offline builds are no panacea. Things fail. The support effort for offline builds is huge, as evidence despite the fact that all of our code is open source very few people bothered trying to compile it because of the complexities.
494
-
495
-
We don’t think building offline is convenient and we always recommended avoiding it. When we build our own apps we use the cloud just like everyone else because it’s surprisingly faster and more convenient…
496
-
497
-
However, some government and regulated industries have issues with SaaS delivered solutions and thus must use offline build. These organizations also require enterprise grade support for most cases and so it makes sense to bundle as an enterprise only solution.
498
-
****
499
-
500
-
501
-
==== Prerequisites for iOS Builds
502
-
503
-
You need the following installed tools/versions for Codename One's offline build process:
504
-
505
-
- Mac ideally with El Capitan, newer should work
506
-
- Xcode 7+ (but not 8+ at this time)
507
-
- Oracle's JDK 8
508
-
- Cocoapods - in the terminal type `sudo gem install cocoapods --pre`.
509
-
- xcodeproj - in the terminal type `sudo gem install xcodeproj`
510
-
511
-
==== Prerequisites for Android Builds
512
-
513
-
Android builds need the following:
514
-
515
-
- Android Studio
516
-
- Oracle's JDK 8
517
-
- Gradle version 2.11
518
-
519
-
==== Installation
520
-
521
-
To build offline you need to install the offline builder code which is a stripped down version of the build servers. When you install a version of the offline builder it maps to the time in which you downloaded it...
522
-
523
-
That means that features like versioned builds won't work. You can download/keep multiple offline builders and toggle between them which is similar in scope.
524
-
525
-
E.g. if you installed an offline builder then installed a newer version and the newer version has a bug you can revert to the old version. Notice that the older version might not have features that exist in a newer version.
526
-
527
-
TIP: Since installation requires an enterprise account, you might need to re-login in the Codename One Settings UI
528
-
529
-
To install an offline builder open the Codename One Settings UI by right clicking the project and selecting #Codename One# -> #Codname One Settings#.
530
-
531
-
.Open Codename One settings
532
-
image::img/developer-guide/newsettings-ui.png[Open Codename One settings,scaledwidth=20%]
533
-
534
-
TIP: Even though the settings are a part of a project, the offline build settings are global and apply to all the projects...
535
-
536
-
Once the Codename One settings UI launches select the #Offline Builds# entry:
When you are in this form you can press the download button to download the current version from the build server. If there is no update nothing will happen. If there is the latest version will download and tag with a version number/date.
547
-
548
-
You can see/change the selected version in this UI. This allows building against an older version. You can also delete older builds to save space.
549
-
550
-
==== Building
551
-
552
-
Offline building is almost like building with the cloud. In the right click menu you can select one of the offline build targets as such:
Once selected build generates a project under the `build/and` or `build/iphone` respectively.
558
-
559
-
Open these directories in Android Studio or xcode to run/build in the native IDE to the device or native emulator/simulator.
560
-
561
-
WARNING: Build deletes previous offline builds, if you want to keep the sources of a build you need to move it to a different directory!
562
-
563
-
To get this to work with Android Studio you will need one more step. You will need to configure Android studio to use your local version of gradle 2.11 by following these steps:
564
-
565
-
- Open the Android Studio preferences
566
-
567
-
.Android Studio Preferences
568
-
image::img/developer-guide/android-studio-preferences.png[Android Studio Preferences,scaledwidth=30%]
Cloud build is far more convenient, simple. Doesn't require any installs (other than the plugin) and is much faster.
587
-
588
-
We built this tool for developers who work in situations that prohibit cloud build. E.g. government, banking etc. where regulation is restrictive.
589
-
590
-
===== Can I Move/Backup my Builders?
591
-
592
-
No.
593
-
594
-
We protect all the builders to avoid abuse. If you backup and restore on a new system the builders might stop working even if you are a paying enterprise customer.
595
-
596
-
===== Can I install the builders for all our developers?
597
-
598
-
Our licensing terms require a parallel developer seat for the Codename One developers in your company. If you have 5 Codename One developers they must all have an enterprise developer account to comply.
599
-
600
-
E.g. You can't have one enterprise account and 4 basic accounts.
601
-
602
-
The reason behind this is simple, in the past we saw a lot of funneling from developers who built such a licensing structure.
603
-
604
-
===== What Happens if I Cancel?
605
-
606
-
If you cancel your enterprise subscription all your existing installed offline builders should work as before but you won't be able to update them or get support for this.
607
-
608
-
===== When are Versions Released?
609
-
610
-
We will try to keep this in the same release pace as library updates i.e. once a week typically on a Friday.
611
-
612
-
===== Are Version Numbers Sequential?
613
-
614
-
They grow but we sometimes skip versions. Versions map to our cloud deployment versioning scheme and we might skip versions in some cases.
615
-
616
-
===== Why is this Feature Limited to Enterprise Subscribers?
617
-
618
-
This is a complex tool to support & maintain. SaaS has a well defined business model where we can reduce prices and maintenance costs.
619
-
620
-
Offline builds are more like a shrinkwrap business model in which case our pricing needs to align itself to shrinkwrap pricing models for long term sustainability.
621
-
622
-
The main use case this product tries to address is government and highly regulated industries who are in effect enterprise users.
623
-
624
-
===== How Different is the Code From Cloud Builds?
625
-
626
-
We use the same code as we do in the cloud build process with minor modifications in the process. Since the cloud servers are setup by us they work differently but should align reasonably well.
627
-
628
-
629
483
=== Android Permissions
630
484
631
485
One of the annoying tasks when programming native Android applications is tuning all the required permissions
@@ -634,36 +488,23 @@ to match your codes requirements, Codename One aims to simplify this. The build
634
488
However, sometimes developers might find the permissions that come up a bit confusing and might not understand why
635
489
a specific permission came up. This maps Android permissions to the methods/classes in Codename One that would trigger them. Notice that this list isn't exhaustive as the API is rather large:
636
490
637
-
`android.permission.WRITE_EXTERNAL_STORAGE` - this permission appears by default for Codename One
638
-
applications, since the `FileSystemStorage` API (which is used extensively) might have some dependencies on it. You can explicitly disable it using the build hint `android.blockExternalStoragePermission=true`, notice that this is something we don't test and it might fail on devices.
639
-
640
-
`android.permission.INTERNET` - this is a hardcoded permission in Codename One, the ability to connect to the network is coded into all Codename One applications.
641
-
642
-
`android.hardware.camera` & `android.permission.RECORD_AUDIO` - are triggered by com.codename1.Capture
491
+
`android.permission.WRITE_EXTERNAL_STORAGE` - included by default (up to Android 13) so file APIs continue to work unless you block it with `android.blockExternalStoragePermission=true`.
643
492
644
-
`android.permission.RECORD_AUDIO` - is triggered by usage of `MediaManager.createMediaRecorder()` & `Display.createMediaRecorder()`
493
+
`android.permission.INTERNET` - always requested because the networking stack depends on it even for offline features like local web views.
645
494
646
-
`android.permission.READ_PHONE_STATE` - is triggered by `com.codename1.ads` package, `com.codename1.components.Ads`,
`Display.getMsisdn()`. This permission is required for media in order to suspend audio playback when you get a phone call.
495
+
`android.permission.CAMERA` & `android.permission.RECORD_AUDIO` - required when capturing photos, video, or audio. The builder injects them automatically and the Android port prompts the user the first time the API is used.
map to `com.codename1.maps` & `com.codename1.location`.
497
+
`android.permission.READ_PHONE_STATE` - used by telephony-aware APIs like `Display.getMsisdn()` and by media integration so audio pauses correctly on calls.
`android.permission.ACCESS_FINE_LOCATION` & `android.permission.ACCESS_COARSE_LOCATION` - requested when using `com.codename1.location` or embedded maps so location fixes can be delivered.
656
500
657
-
`android.permission.READ_CONTACTS` - triggers by the package `com.codename1.contacts` & `Display.getAllContacts()`.
501
+
`android.permission.ACCESS_BACKGROUND_LOCATION` - added when background geofencing or fetch tasks are enabled; the Android port verifies the permission separately on Android 10+.
658
502
659
-
`android.permission.VIBRATE` - is triggered by `Display.vibrate()` and `Display.notifyStatusBar()`
503
+
`android.permission.POST_NOTIFICATIONS` - prompted on Android 13+ for both push registration and local notifications.
660
504
661
-
`android.permission.SEND_SMS` - is triggered by `Display.sendSMS()`
505
+
`package.permission.C2D_MESSAGE`, `com.google.android.c2dm.permission.RECEIVE`, and `android.permission.RECEIVE_BOOT_COMPLETED` - bundled with the push subsystem so Firebase Cloud Messaging can wake the app after device restarts.
662
506
663
-
`android.permission.WAKE_LOCK` - is triggered by `Display.lockScreen()` & `Display.setScreenSaverEnabled()`
664
-
665
-
`android.permission.WRITE_CONTACTS` - is triggered by `Display.createContact()`, `Display.deleteContact()`,
`android.permission.READ_CONTACTS` - requested when accessing the device address book through `Display.getAllContacts()` and related APIs.
667
508
668
509
==== Permissions Under Marshmallow (Android 6+)
669
510
@@ -675,13 +516,7 @@ This is really great as it allows apps to be installed with a single click and n
675
516
676
517
===== Enabling Permissions
677
518
678
-
Codenmae One compiles Android targets with SDK level 23 but not with target level 23!
679
-
680
-
This means that by default the new permission mode is still off and you won't see any of the effects mentioned below.
681
-
682
-
WARNING: This will probably change to the default in the future but at the moment the target SDK defaults to 21
683
-
684
-
To activate this functionality you will need to set the target SDK to level 23 by using the `android.targetSDKVersion=23` build hint.
519
+
Codename One's Gradle 8 based Android builder detects the highest Android SDK you have installed and uses that value (with a minimum of API 33) for both the compile and target SDK versions, so the modern runtime permission flow is enabled by default. If you override the target version via the `android.targetSDKVersion` build hint the builder will honour it, but lowering the target may disable some compatibility libraries. Keeping the target current is strongly recommended for Play Store compliance.
When we try to install this app without changing anything on an Android 6 device we see this UI:
545
+
If you explicitly lower the target SDK (e.g. `android.targetSDKVersion=21`) and install this app on an Android 6 device you will still see the legacy install prompt with all permissions listed up front:
711
546
712
547
.Install UI when using the old permissions system
713
548
image::img/developer-guide/marshmallow-permissions-level21.png[Install UI when using the old permissions system,scaledwidth=20%]
714
549
715
-
When we set `android.targetSDKVersion=23` in the build hints and try to install again the UI looks like this:
550
+
When you keep the default target (API 33+) the installer defers to the runtime permission flow and the install UI looks like this instead:
716
551
717
552
.Install UI when using the new permissions system
718
553
image::img/developer-guide/marshmallow-permissions-level23.png[Install UI when using the new permissions system,scaledwidth=20%]
@@ -3795,4 +3630,3 @@ You will notice 3 big things that aren't covered in this unified framework:
3795
3630
3796
3631
- Versioned builds - there is a lot of complexity in the versioned build system. This might be something we address in the future but for now I wanted to keep the framework simple.
3797
3632
3798
-
- Offline builds - Offline builds work through manual download and aren't subjected to this framework
0 commit comments