B4J Question [ABMaterial] Is it possible to create and linking a manifest.json file to it?

Mashiane

Expert
Licensed User
Longtime User
Hi there

As per subject matter, is this possible? Example...

B4X:
{
    "name": "",
    "icons": [
        {
            "src": "/android-chrome-192x192.png",
            "sizes": "192x192",
            "type": "image/png"
        },
        {
            "src": "/android-chrome-512x512.png",
            "sizes": "512x512",
            "type": "image/png"
        }
    ],
    "theme_color": "#ffffff",
    "background_color": "#ffffff",
    "display": "standalone"
}
 

alwaysbusy

Expert
Licensed User
Longtime User
Sure. Just save it in the /images/ folder and in ABMApplication set ABM.Manifest = "manifest.json" in Initialize.

The reason it should be in the images folder is because most 'icon' generators on the the net also give the possibility to generate such a manifest.json file automatically.

e.g. The manifest.json file for some of our apps:

B4X:
{
    "manifest_version": 2,
    "name": "OneTwo",
    "description": "OneTwo",
    "version": "3.0",
    "icons": {
    "128": "favicon-128x128.png"   
    },
    "app": {
    "urls": [
    "http://xxxxx.one-two.com:51043/OneTwo/"

    ],
    "launch": {
    "web_url": "http://xxxxx.one-two.com:51043/OneTwo/"
    }
    },
    "permissions": [
    "unlimitedStorage",
    "notifications"
    ]
 }

In our apps the Initialize looks something like this:

B4X:
Public Sub Initialize
   Pages.Initialize   
   PageNeedsUpload.Initialize

   ' add your icons
   ABM.AddAppleTouchIcon("apple-touch-icon.png", "180x180")
   ABM.AddMSTileIcon("mstile-150x150.png", "144x144")
   ABM.AddFavorityIcon("favicon-32x32.png", "32x32")
   ABM.AddFavorityIcon("favicon-16x16.png", "16x16")
   
   ABM.AppVersion = ABMShared.AppVersion
   ABM.AppPublishedStartURL = ABMShared.AppPublishedStartURL
   ABM.MaskIcon = "safari-pinned-tab.svg"
   ABM.MaskIconColor = ABM.COLOR_BLACK
   ABM.MaskIconColorIntensity = ABM.INTENSITY_LIGHTEN1
   ABM.MSTileColor = ABM.COLOR_BLACK
   ABM.MSTileColorIntensity = ABM.INTENSITY_LIGHTEN1
   ABM.AndroidChromeThemeColor = ABM.COLOR_BLACK
   ABM.AndroidChromeThemeColorIntensity = ABM.INTENSITY_LIGHTEN1   
   ABM.Manifest = "manifest.json"
   
   ABM.SetFontSizePercentages(80,90,100)

   Dim p As Period
   p.Initialize
   p.Months = 3
   ABM.SiteExpires = DateUtils.AddPeriod(DateTime.Now, p)
   
   #If RELEASE       
       ABM.LoadJavascriptsAfterDOM = True
       ABM.ActivateUseCDN(DONATORKEY, "https://cdn.jsdelivr.net/gh/RealAlwaysbusy/ABMaterial@v4.25/")
       ABM.ActivateGZip(DONATORKEY, 1000) 
   
       Dim folders As List
       folders.Initialize
       folders.Add(File.DirApp & "/www/" & ABMShared.AppName & "/images")
       ABM.ActivatePNGOptimize(DONATORKEY, folders, False , 9, False, True)
   #End If
   
   BuildPage   
End Sub
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
Sure. Just save it in the /images/ folder and in ABMApplication set ABM.Manifest = "manifest.json" in Initialize.

Just another example of AB's coder elves hard at work...

Who the hell dreams up this stuff anyways? Just freakin amazing to me - the ultimate number one dummie!
Thank you lord for copy and paste...
 
Upvote 0
Top