Android Example Base app for new user to rapid build app

Update 29/8/2018: i uploaded new version without FIREBASE to help who dont need

B4A is very good app to build Android app.
I want to use it built app same as Android Studio, so i make a "BASE" app to make more apps from it
Since 8/2018, you must set target SDK is 26, so many changes to your old app to make it!

This base app has "Drawer","Search","Multi Layout", "AdMOD ads", Runtime Permission
Dialog,....
very EASY to USE and READ

After run , your app is ready to make more

HXrDlS1.png


Have some menu on Drawer

ybBVynz.png


Has two layout demo, you can add more, and add banner admob too, you can change your admob id to use!
GM7zoa3.png


Search dialog demo

134Th35.png

Runtime Permission support tooo

You need add these library to use(almost them is core of B4A >8)
ljvSDW5.png


When you build new app, you only need change appname, add some menu, load your layout, ENJOY!

If you has any update, please post here, i will update in #1 post to other member can see and reuse for fast developing

New app with base template app:
Download profile picture for instagram

Please download and try it and rate if you like ^^
If anyone need know more about this app how to work, can ask to me to answer

https://play.google.com/store/apps/details?id=com.download.profilepicture.forinstagram
 

Attachments

  • base-app-source.zip
    409.3 KB · Views: 1,044
  • baseapp-withoutFIREBASE.zip
    408.8 KB · Views: 865
Last edited:

peacemaker

Expert
Licensed User
Longtime User
Thanks for the good template !
I'd like to suggest also some of my code:
B4X:
#Region  Service Attributes
    #StartAtBoot: False
    #ExcludeFromLibrary: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

    Dim InternetConnected As Boolean, ph As PhoneEvents
    Public logs As StringBuilder
    Private logcat As LogCat
End Sub

Sub Service_Create
    'This is the program entry point.
    'This is a good place to load resources that are not specific to a single activity.
    logs.Initialize
    #if RELEASE
    logcat.LogCatStart(Array As String("-v","raw","*:F","B4A:v"), "logcat")
    #end if
    ph.Initialize("ph")

End Sub

Sub Service_Start (StartingIntent As Intent)

End Sub

Sub Service_TaskRemoved
    'This event will be raised when the user removes the app from the recent apps list.
End Sub

'Return true to allow the OS default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    'wait for 500ms to allow the logs to be updated.
    Dim jo As JavaObject
    Dim l As Long = 500
    jo.InitializeStatic("java.lang.Thread").RunMethod("sleep", Array(l))
    logcat.LogCatStop
    logs.Append(StackTrace)

    Dim email1 As Email
    email1.To.Add("[email protected]")
    email1.Subject = Application.LabelName & ": app crash v." & Application.VersionName
    
    Dim hw1 As Phone
    email1.Body = "Mf=" & hw1.Manufacturer & "; Model=" & hw1.Model & "; Product=" & hw1.Product & "; SdkVersion=" & hw1.SdkVersion & CRLF & CRLF & logs
    Dim intent As Intent = email1.GetIntent
    intent.WrapAsIntentChooser("Email:")
    StartActivity(email1.GetIntent)
    ToastMessageShow(Application.LabelName & ": send this bug-report to the developers now", True)
    Return True
End Sub

Sub Service_Destroy

End Sub

Private Sub logcat_LogCatData (Buffer() As Byte, Length As Int)
    logs.Append(BytesToString(Buffer, 0, Length, "utf8"))
    If logs.Length > 20000 Then
        logs.Remove(0, logs.Length - 19000)
    End If
End Sub

Sub ph_ConnectivityChanged (NetworkType As String, State As String, Intent As Intent)
    If State = "CONNECTED" Then
        Log("ph_ConnectivityChanged: CONNECTED" & "," & NetworkType)
        InternetConnected = True
    Else    'NO INTERNET
        Log("ph_ConnectivityChanged: DISCONNECTED")
        InternetConnected = False
    End If
End Sub

Dependecies: Phone and JavaObject libs.
Features:
* system crash bug report via email
* Internet-connection state
 

Josias

Member
Licensed User
Longtime User
Thx for sharing this example. When I compile I get a build error stating that it 'Could not find file - Issue-Example\AppCompat\google-services.json'.

Any idea why this is the case?
 

konradwalsh

Active Member
Licensed User
Longtime User
Thats because you dont have
B4X:
Example\AppCompat\google-services.json'

You need to set up your google services and download YOUR json file.. It might be better to search the forums. You will find plenty of help on that exact question
 

Colin Evans

Active Member
Licensed User
Longtime User
Good idea but I wouldn't want to use Google services or Firebase every time I wanted to create an app
 

konradwalsh

Active Member
Licensed User
Longtime User
Good idea but I wouldn't want to use Google services or Firebase every time I wanted to create an app
I think that's the point..
He has put together many of the things someone wants.
Its a lot easier to turn something off and still use the base
 

MarkusR

Well-Known Member
Licensed User
Longtime User
i think every app have different requirements, but a template app with everything to look how it is done is good to have.
as example text input via voice, sqlite usage, using of web apis, collecting photos, read barcodes, send mails, custom controls, ...
 

Colin Evans

Active Member
Licensed User
Longtime User
I do think this would be a brilliant app for novice's like myself if it didn't rely on Google Service / Firebase but as a novice I wouldn't know which bits to 'turn off' to be able to use the app in its current form
 

tuhatinhvn

Active Member
Licensed User
Longtime User
Last edited:

konradwalsh

Active Member
Licensed User
Longtime User
Thank you for your suggestions, Update 29/8/2018: i uploaded new version without FIREBASE to help who dont need it!

New app with base template app:
Download profile picture for instagram


Please download and try it and rate if you like ^^
Whilst interesting.. I think adding this is diluting the benefits of what you have created here. Extremely few people will want an instagram downloader in their app. I would suggest moving that to a separate thread
 

tuhatinhvn

Active Member
Licensed User
Longtime User
Whilst interesting.. I think adding this is diluting the benefits of what you have created here. Extremely few people will want an instagram downloader in their app. I would suggest moving that to a separate thread
Sorry about it, i want to show that from this base template app, anyone can make more good apps, i dont include sourcode of instagram downloader app because it not main function of this thread
 

konradwalsh

Active Member
Licensed User
Longtime User
Sorry about it, i want to show that from this base template app, anyone can make more good apps, i dont include sourcode of instagram downloader app because it not main function of this thread

I think you are doing something quite amazing so far..

I think it would be amazing if @Erel included it in B4X as a well-commented example base application that people can learn from. I imagine it would reduce the amount start questions
 

Colin Evans

Active Member
Licensed User
Longtime User
Excellent for novice programmers like myself, its a good starting point and shows extremely well what can be done, and I agree Erel would make it easier for all the new comers to B4A if something similar to this was included, it would lessen the amount of start up questions

'tuhatinhvn' well done and thank you
 

Bothwell

Member
Licensed User
Hi

in B4A version 9.01.2 I cant find the TabStripViewPager on the libraries on the sceenshot below


Update 29/8/2018: i uploaded new version without FIREBASE to help who dont need

B4A is very good app to build Android app.
I want to use it built app same as Android Studio, so i make a "BASE" app to make more apps from it
Since 8/2018, you must set target SDK is 26, so many changes to your old app to make it!

This base app has "Drawer","Search","Multi Layout", "AdMOD ads", Runtime Permission
Dialog,....
very EASY to USE and READ

After run , your app is ready to make more

HXrDlS1.png


Have some menu on Drawer

ybBVynz.png


Has two layout demo, you can add more, and add banner admob too, you can change your admob id to use!
GM7zoa3.png


Search dialog demo

134Th35.png

Runtime Permission support tooo

You need add these library to use(almost them is core of B4A >8)
ljvSDW5.png


When you build new app, you only need change appname, add some menu, load your layout, ENJOY!

If you has any update, please post here, i will update in #1 post to other member can see and reuse for fast developing

New app with base template app:
Download profile picture for instagram

Please download and try it and rate if you like ^^
If anyone need know more about this app how to work, can ask to me to answer

https://play.google.com/store/apps/details?id=com.download.profilepicture.forinstagram
 

Bothwell

Member
Licensed User

asales

Expert
Licensed User
Longtime User
Thanks this works, but when I add CustomListView this line of code fails with too many parameters
clvmenu.Add(CreateListItem("home.png","Home",False, clvmenu.AsView.Width, 50dip), 50dip, "Home")
1 - Add XUI Views to the project.
2 - change the clvmenu component in the Left layout to the new customlistview
3 - Change the lines of clvmenu to:
B4X:
clvmenu.Add(CreateListItem("home.png","Home",False, clvmenu.AsView.Width, 50dip), "Home")
 

asales

Expert
Licensed User
Longtime User
Here the example without Firebase updated.
 

Attachments

  • baseapp-withoutFIREBASE_UPDATED.zip
    408.1 KB · Views: 401

Bothwell

Member
Licensed User
I am trying the updated version but it fails with "unknown type " as it is missing inputDialog library

B4X:
Dim searchdia As InputDialog

are you able to share your additional libraries folder so I can at least compile this ? or share the link where the inputDialog library is

where do i get B4A libraries, its seems they are not located in one place but various threads throughout the forum ? I find this a little bit frustrating. how do we know you are reading the correct thread with the latest library ? are they not located in a central repository of some sort ?
 

asales

Expert
Licensed User
Longtime User
are you able to share your additional libraries folder so I can at least compile this ?
Here the list of libraries uses in the example:
libs_baseapp3.jpg

where do i get B4A libraries, its seems they are not located in one place but various threads throughout the forum ?
Correct. You need to the the forum search.
how do we know you are reading the correct thread with the latest library ?
See the information in the post of the library, like this:
V4.01 is released with several improvements
https://www.b4x.com/android/forum/threads/dialogs-library.6776/
are they not located in a central repository of some sort ?
Correct. You need to the the forum search.
 
Top